use quit instead close

It seems, it is more reliable to use quit instead of close. 
close - socket level command. 
quit - protocol level command. 

It is impossible to recognize that socket is closed intentionally or due to network problems. 
Some servers check if socket is closed in the middle of uploading, this file is considered corrupted and removed. To avoid it, it should use quit command.