Fix line collapse at end of file in text output