Handle IOExceptions when reading files.