You can just save the file object and write it whenever you want. You may need to clear it after each recording to make things visible to the outside world.
If you are recording from another process, simply open the file in add mode ("a").
lazy1 source
share