can you show how your writing to the file? You say stat won't work cause of buffering .. can you just autoflush with
Asking for your code to see if with the print statements it can keep a counter of the bytes written out.. so right there you can close the handle and reopen w/a different filename.