ensure that the file opened to parse nagios config is properly closed