Flushed the file buffer after a write

The stdio write has a buffer. The buffer is flushed only when full, on close or on a flush() call.
I added the flush() call. The file content will be then visible for the kernel and for other processes.