Fixed an IO bug when the config file was being opened and closed more than once in a short time.