title: Multiprocesssing manager shutdown gives error Access Denied
body: <p>I have a function that runs over a number of tables in a sqlite database. It reads the data, does some stuff and then saves the result in a csv-file.</p>
  
  <pre><code>from __future__ import division
  
  import sqlalchemy as sql
  import pandas as pd
  import os
  import multiprocessing as mp
  
  dst = r'H:\Results'
  
  eng = sql.create_engine('sqlite:///Y:/Database/some.db') # database on external drive
  con = eng.connect() 
  
  def get_res(tab_name,lock):
      query_tr = """SELECT t, p, size, event, direction \
      FROM {tb} WHERE event IN (4, 5)""".format(tb=tab_name)
  
      df_tr = pd.read_sql_query(query_tr,con)
      # do some stuff with df_tr ...
  
      with lock:
          df_tr.to_csv(os.path.join(dst,'my_res.csv'), mode='a')
  
      return 1
  </code></pre>
  
  <p>I do this in parallel like so</p>
  
  <pre><code>if __name__=='__main__':
  
      workers = mp.cpu_count()
  
      tables = sql.inspect(eng).get_table_names()
  
      man = mp.Manager()
      pool = mp.Pool(workers)
      lock = man.Lock()
      res = {tab_name: pool.apply_async(get_res,(tab_name,lock)) for tab_name in tables}
      pool.close()
      pool.join()
      man.shutdown()
  </code></pre>
  
  <p>The strange thing is that the call <code>man.shutdown()</code> returns a <code>Windows Error 5: Access Denied</code> when the function reads the data from a database that is on an <strong>external</strong> hard disk drive, but works absolutely fine when the database is on the computer's hard drive. The function <code>get_res</code> goes through correctly without any error and does what it should do. </p>
  
  <p>I know that this is not much to go on, but are there any suggestions why that could be the case? </p>