Flush writing to file in order to monitor progress