title: Python: Multiprocessing Does Not Complete Jobs
body: <p>I'm using python 2.7 with multiprocessing::Pool to run a job in parallel</p>
  
  <p>I've simplified the example below, but here's the main gist of it. </p>
  
  <p>It will create a file for each person in my dict using the <code>apply_async()</code> function. However when I check to see if the file was created properly, I notice that sometimes the file was not created. </p>
  
  <p>Now I'm thinking I've done something wrong in how I used multiprocessing::Pool</p>
  
  <p>Any advice?</p>
  
  <pre><code>import os
  from multiprocessing import Pool
  
  def outputFile(person):
      ofh=open(person+'.txt','w')
      ofh.write('test\n')
      ofh.close()
  
  pool = Pool(processes=4)
  for person in person_dict:
      pool.apply_async(outputFile,args(person))
  pool.close()
  pool.join()
  for person in person_dict:
      print os.path.isfile(person+'.txt')
  </code></pre>
  
  <hr>
  
  <pre><code>True
  True
  False
  True
  </code></pre>