Fix for a merged pull request: close log file only if it's been opened in Logger destructor