title: What can lead to "IOError: [Errno 9] Bad file descriptor" during os.system()?
body: <p>I am using a scientific software including a Python script that is calling <code>os.system()</code> which is used to run another scientific program. While the subprocess is running, Python at some point prints the following:</p>
  
  <pre><code>close failed in file object destructor:
  IOError: [Errno 9] Bad file descriptor
  </code></pre>
  
  <p>I believe that this message is printed at the same time as <code>os.system()</code> returns.</p>
  
  <p>My questions now are:</p>
  
  <p>Which conditions can lead to this type of IOError? What does it exactly mean? What does it mean for the subprocess that has been invoked by <code>os.system()</code>?</p>