title: Requests download with retries creates large corrupt zip
body: <p>relative beginner here. I'm trying to complete a basic task with Requests, downloading zip files. It works fine on most downloads, but intermittently writes over-sized, corrupt zip files when working with large downloads (&gt;5 GB or so). For example, there is a zip file I know to be ~11 GB that shows up anywhere between 16 and 20 GB, corrupted.</p>
  <p>When unzipping in Windows Explorer, I get &quot;The compressed (zipped) folder is invalid&quot;. 7-Zip will extract the archive, but says:</p>
  <p>Headers Error --- Unconfirmed start of archive --- Warnings: There are some data after the end of the payload data</p>
  <p>Interestingly, the 7-Zip dialog shows the correct file size as 11479 MB.</p>
  <p>Here's my code:</p>
  <pre><code>save_dir = Path(f&quot;{dirName}/{item_type}/{item_title}.zip&quot;)
  file_to_resume = save_dir
  try:
      with requests.get(url, stream=True, timeout=30) as g:
          with open(save_dir, 'wb') as sav:
              for chunk in g.iter_content(chunk_size=1024*1024):
                  sav.write(chunk)
  except:
      attempts = 0
      while attempts &lt; 10:
          try:
              resume_header = {'Range':f'bytes = {Path(file_to_resume).stat().st_size}-'}
              with requests.get(url, stream=True, headers=resume_header, timeout=30) as f:                        
                  with open(file_to_resume, 'ab') as sav:
                      for chunk in f.iter_content(chunk_size=1024*1024):
                          sav.write(chunk)
              break
          except:
              attempts += 1
  </code></pre>