Prevent seeking beyond the end of the file