On write operation, the data is not written immediately on file; it is buffered. The entry (e.g. file size) in the directory is not updated neither so if there is a crash the file may be left empty.
Instead of closing the file, you can use the Flush File function once in a while. This function writes any buffered data on disk and updates the directory entry so the data already there is pretty safe if there is an "unexpected termination" without closing the file. The Flush function does not affect the file current offset so the new data written is appended.
One supplemental precaution when opening the file for writing is to wire the deny mode input to "deny read/write". By default, "Opene File" function allows other apps to open the same file for simul
taneous read and write. This is seldom required. "Deny read/write" prevents other applications like MSOffice FindFast or antivirus scanning to open your file for indexing and denying your app further write access and causing write errors.