Flush plot file after writing