flush invalid lines to file and zero the pointer.