Properly deal with I/O errors when parsing config files.

Fixes #3152