title: Python won't write to file
body: <p>I am attempting to write a pretty printed email to a .txt file so i can better view what I want to parse out of it.</p>
  
  <p>Here is this section of my code:</p>
  
  <pre><code>result, data = mail.uid('search', None, "(FROM 'tiffany@e.tiffany.com')") # search and return uids instead
  latest_email_uid = data[0].split()[-1]
  result, data = mail.uid('fetch', latest_email_uid, '(RFC822)')
  raw_email = data[0][1]
  
  html = raw_email
  soup = BS(html)
  pretty_email = soup.prettify('utf-8')
  
  f = open("da_email.txt", "w")
  f.write(pretty_email)
  f.close
  </code></pre>
  
  <p>I am not running into any errors, but I can't get it to write the data to the file.  I know that the data is properly stored in the pretty_email variable because I can print it out in console.</p>
  
  <p>Any thoughts?</p>
  
  <p>MY UPDATED CODE THAT STILL DOESN'T WORK:</p>
  
  <pre><code>result, data = mail.uid('search', None, "(FROM 'tiffany@e.tiffany.com')") # search and return uids instead
  latest_email_uid = data[0].split()[-1]
  result, data = mail.uid('fetch', latest_email_uid, '(RFC822)')
  raw_email = data[0][1]
  
  html = raw_email
  soup = BS(html)
  pretty_email = soup.prettify('utf-8')
  
  with open("da_email.txt", "w") as f:
      f.write(pretty_email)
  </code></pre>