Set the file writer to flush the stream before closing it(hopefully to
stop the incomplete file writes).