builtin-grep: terminate correctly at EOF