Make sure transaction state resets after commit

[fixes #12566]
Merge pull request #13935 from arthurnn/fix_12566

Make sure transaction state resets after commit