Close socket and sendall data

Hi,

I've added sk.close(), to close properly the socket at the end and I've replaced send() by sendall() to be sure that everything has been sent, as explained in Python documentation: https://docs.python.org/2/library/socket.html#socket.socket.sendall

Thanks for the merge.

Regards.