Make sure transaction state resets after commit

[fixes #12566]