add monkey patch to write file only after commit

This ensure a file is never created on filesystem while transaction will restart.

This former behavior was creating multiple times the same file on serialized error.
The action is not removed from the `transaction_actions` once executed.