I need to save data from my program at certain intervals (in case my program gets terminated/evicted).
In order for the data to be saved... must the file be closed?
Is there an efficient way to do this or just what I am thinking:
At given intervals:
-Check if temp file is open... open the file
-write data to file
-close the file
- ... wait for next interval