Fix #12800: Rollback in case of exceptions.
Cancel transaction in case of StateMachineNotFound exception.
Merge fix for failed transaction rollbacks