In FTP.close() method, make sure to also close the socket object, not only the file.
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 22b5fd2..fd5a863 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -589,11 +589,11 @@
 
     def close(self):
         '''Close the connection without assuming anything about it.'''
-        if self.file:
+        if self.file is not None:
             self.file.close()
+        if self.sock is not None:
             self.sock.close()
-            self.file = self.sock = None
-
+        self.file = self.sock = None
 
 try:
     import ssl