Catch exception when opening invalid file.