In Windows, cache is a self-contained subsystem that follows its own criteria for data flow from a file cache to disk, regardless of the readings that are made, and even if it is closed.
The two easy ways to ensure the data integrity of a transaction on a file is:
1) Move data at the end of transaction by calling FlushFilebuffers in the case of Windows
2) Open file without cache, making it more slow
Say that, if you capture a set of data that may be recorded in a file, it's a good practice to call FlushFilebuffers at the end of all recordings (not every put), that informs to cache subsystem to move data to disc, without a need to close the file. But to do this, is necesary to use handle=FILEATTR(fileno, 2) and use this obtained handle in the call to FlushFilebuffers from the windows API, unless another way is implemented.
EDIT: May be FellippeHeitor tesis, that on close the system flushes the data, is correct, but needs the filename to reopen.