Fix a possibly broken transaction rollback

If there was an exception during beginning a transaction,
a rollback call is highly likely to just throw a new,
unrelated error, confusing the developer.