Ensures transaction committed/closed is in same try block

to absolutely make sure that a transaction id marked as committed will
have its counterpart, marking as closed, sit in the finally block of
the try block marking as committed.
Merge pull request #3054 from tinwelint/2.2-tx-committed-close-gap-fix

Ensures transaction committed/closed is in same try block