title: CSVWriter not saving data to file the moment I write it
body: <p>Python newbie getting a bit frustrated with the csv module. At this rate, it would have been easier if I wrote the file parser myself, but I want to do things the Pythonic way ....</p>
  
  <p>I have written a little python script that should save my data into a CSV file.</p>
  
  <p>Here is a snippet of my code:</p>
  
  <pre><code>import csv
  
  wrtr = csv.writer(open('myfile.csv','wb'),delimiter=',', quotechar='"')
  
  for row in rows:
      wrtr.writerow([row.field1,row.field2,row.field3])
  </code></pre>
  
  <p>The file myfile.csv is created successfully, yet it is empty - but has a lock on it, as its still being used by the Python process. It seems that the data has been written to the file in memory, but it has not yet been flushed to disk.</p>
  
  <p>Since the Python process is holding a lock on the file, then I assume that I am responsible for releasing the lock. Here are my questions:</p>
  
  <ol>
  <li>How do I get python to flush to disk</li>
  <li>How do I close the file that was opened in the csv.writer() method?</li>
  </ol>