Report file opening failures rather than crashing

Fixes #238.  Hat tip @kern3020.
merge fix from samtools group