Improved error handling in BinaryReader when loading a file (fixes a segfault)