Allow config loader to recover from fatal errors

The config loader now registers shutdown function which can print out
error message in case of loading config file fails.

Fixes bug #3980
Move assignment out of if
Gettext is already loaded at this point