Fixing an uncaught system exception, and closing config file after configuration excraction.