Proper "closing" of the config file is necessary, and you should do it once only upon exiting the entire code.
What I mean is that the Config File could be already closed (by the outside Case), when you are trying to access it through the even case(s).