Flush logfile after every write