title: python does not release filehandles to logfile
body: <p>I have an application which has to run a number of simulation runs. I want to setup a logging mechanisme where all logrecords are logged in a general.log, and all logs for a simulation run go to run00001.log, .... For this I have defined a class Run. in the <code>__init__()</code> a new filehandle is added for the runlog. </p>
  
  <p>The problem is that the logfiles for the runs never get released, so after a number of runs the available handles are exhausted and the run crashes.</p>
  
  <p>I've set up some routines to test this as follows</p>
  
  <p>main routine</p>
  
  <pre><code>import Model
  try:
      myrun = Model.Run('20130315150340_run_49295')
      ha = raw_input('enter')
      myrun.log.info("some info")
  except:
      traceback.print_exc(file=sys.stdout)
  
  ha = raw_input('enter3')
  </code></pre>
  
  <p>The class Run is defined in module Model as follows</p>
  
  <pre><code>import logging
  class Run(object):
  
      """ Implements the functionality of a single run. """
      def __init__(self, runid):
          self.logdir="."
          self.runid          = runid
          self.logFile        = os.path.join(self.logdir , self.runid + '.log')
          self.log            = logging.getLogger('Run'+self.runid)
          myformatter         = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
          myhandler      = logging.FileHandler(self.logFile)
          myhandler.setLevel(logging.INFO)
          myhandler.setFormatter(myformatter)
          self.log.addHandler(myhandler) 
  </code></pre>
  
  <p>Then I use the program process explorer to follow the filehandlers. And I see the runlogs appear, but never disappear.</p>
  
  <p>Is there a way I can force this?</p>