Fixed a resource leak with config files