Improved the error message for bad file I/O.