Add logfile.flush() and os.fsync() to the logger so that the file updates quicker