Improve error message when trying to open a config file.

Refs #5666