(__open_catalog): Fix problems with reading non-files. Always close file.