I believe @solamour solved a similar problem here:
Unfortunately I have no knowledge of transaction end commands…