title: Pickle (Python 3.6) Writes Empty File
body: <p>I'm trying to teach myself Python and so created a dumb script to check a blogging website to check for new updates and then save metadata associated to the updates. If there are new posts, I open the previous metadata, append the new metadata, and then save.  However, I find that quite often (can't figure out when it does and does not work), these updates produce an empty file, and I lose all the metadata.</p>
  
  <pre><code>if new_post_count &gt; 0:
          file_name = 'all_posts' + user
  
          previous_posts = pickle.load(open(file_name, 'rb'))
  
          current_posts = get_posts(client, user, start_from_posts=0, total_posts=new_post_count)
  
          all_posts = previous_posts.extend(current_posts)
  
          f = open(file_name, 'wb')
          pickle.dump(all_posts, f)
          f.close() 
  </code></pre>
  
  <p>Looking at the forums, it might make more sense to use something else to save my data besides pickle (any suggestions?). Even if that's the case, I'd still like to know what I'm doing wrong here so I don't create the same mistake later.</p>