Changing how a transaction closed the connection when an error happens