title: Issue with removing files in python
body: <p>I'm currently having some issues removing a file in python. I am creating a temporary file for pdf to image conversion. It is housed in a folder that holds a .ppm file and converts it to a .jpg file. It then deletes the temporary .ppm file. Here is the code: </p>
  
  <pre><code>    import pdf2image
      from PIL import Image
      import os
  
      images = pdf2image.convert_from_path('Path to pdf.pdf', output_folder='./folder name')
      file = ''
      for files in os.listdir('./folder name'):
          if files.endswith(".ppm"):
              file = files        
      path = os.path.join('folder name',file)
      im = Image.open(path)
      im.save("Path to image.jpg")
      im.close()
      os.remove(path)
  </code></pre>
  
  <p>The issue is at the end in the os.remove(path). I get the following error:</p>
  
  <pre><code>PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'path to ppm file'
  </code></pre>
  
  <p>I would appreciate any help and thanks in advance.</p>