Fixed a bug where thrown file errors were not getting caught.