Config file error handling. Close file in case of errors.