title: Permission denied when using TimedRotatingFileHandler
body: <p>I made a REST API using Flask-RESTFUL for this one and I need to generate log files for this</p>
  
  <p>I am getting an error when I have to run my API again. this occurs when it is logging on to the file.</p>
  
  <pre><code> PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
  </code></pre>
  
  <p>To avoid this error, I had to delete the file but the same error occurS when another computer tries to access the API. </p>
  
  <p>I have my config.py code initializing the app configuration of my logging module.</p>
  
  <pre><code>        import os
          from datetime import date
          import logging
          import logging.handlers as handlers
  
          class BaseConfig(object):
              DEBUG = False
              TESTING = False
              LOGGING_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
              #LOGGING_LOCATION = 'logs/bookshelf.log'
  
  
          class DevelopmentConfig(BaseConfig):
              DEBUG = True
              TESTING = True
  
  
  
          class TestingConfig(BaseConfig):
              DEBUG = False
              TESTING = True
  
          class ProductionConfig(BaseConfig):
              DEBUG = False
              TESTING = False
  
  
  
          config = {
              "development": "config.DevelopmentConfig",
              "testing": "config.TestingConfig",
              "default": "config.DevelopmentConfig",
              "production": "config.ProductionConfig"
          }
  
  
          def configure_app(app):
  
              #ENVRIONMENT CONFIGURATION
              config_name = os.getenv('FLASK_CONFIGURATION', 'default')
              #config_name = os.getenv('FLASK_CONFIGURATION', 'production') #UNCOMMENT IF PROD
              app.config.from_object(config[config_name]) # object-based default configuration
              #handler = logging.FileHandler(app.config['LOGGING_LOCATION'])
              handler = handlers.TimedRotatingFileHandler('logs/'+str(date.today())+'-mipay-error.log', when='M', interval=1)
              formatter = logging.Formatter(app.config['LOGGING_FORMAT'])
              #handler.setLevel(app.config['LOGGING_LEVEL'])
              handler.setFormatter(formatter)
              app.logger.addHandler(handler)
              #LOGGING CONFIGURATION
  </code></pre>
  
  <p>I have read that it is required to close the file but I do not know when and how to close the log file.  </p>