Fix dummy records created if the last character is line break

The fix add the checking logic at the end of each line processing, if it reach the end ('\0' read), then stop the parse.