Report file opening failures rather than crashing

Fixes #238.  Hat tip @kern3020.