Check the return value of flush_write_file() and report an error