Throw proper I/O errors rather than "fuck"

Fixes #7.