properly detect EOF with mmap parsing