Do you close the file?

I'm pretty sure output is buffered and if the file is not closed
properly it will not get flushed to disk.

Cheers