fclose() already flushes the buffers before closing the file