In FTP.close() method, make sure to also close the socket object, not only the file.