Prevent sequential reads to read past end of file