catch file opening errors; fixes #3