title: How to write to CSV asynchronously
body: <p>I have to test about one million possible urls. If the url is valid I want to store it in a CSV. 
  To speed things up I want to use asynchronously.
  Code works fine when ran with a for loop, but the CSV is empty if I run it asynchronously.</p>
  
  <pre><code>    #Declare CSV
  import csv
  csvFile = open('example.tsv', 'w', newline='')
      csvWriter = csv.writer(csvFile, delimiter='\t', lineterminator='\n\n')
  
      def parse(url):
          #get url's &lt;title&gt;
          data = getTitle(url)
          #if record is found
  
          if(data.title.string != "RECORD INACTIVE" or data.title.string != "FOUND"):
              csvWriter.writerow([url])
  
  
      with ProcessPoolExecutor(max_workers=4) as executor:
          {executor.submit(parse, url): url for url in URLS} 
  </code></pre>
  
  <p>When I run this Asunchronously the CSV file is empty.</p>
  
  <p>But it works if I run it with a fro loop :</p>
  
  <pre><code>for url in URLS:
      parse(ul)
  </code></pre>