Adding flushing of file output