Process invalid lines in a function and add prepare to flush to file.