flush output file after each row grabbed