Fixed transaction crash

If a query inside a transaction failed we would leave the transaction
open, preventing other transactions. now we perform a rollback when
entering a rescue.