Better file error handling

Closes #65