Restore Connection Auto-Commit on Exception

These changes addresses the problem when the underlying database driver throws error on commit in transactional mode. Previously the auto-commit state was not restored when throwing, thus creating inconsistent connections in the pool which then typically caused connections to hang when used non-transactional. This behaviour is especially sneaky in systems with large database pools where connection auto-commit state might be compromised over a longer period, creating hanging connections which might be hard to explain. 
Checking `containsKey` before calling `remove` is redundant and should be removed