Close connection after transaction error