Close successfull socket connections.

I even assigned them to a variable for this purpose.
Remove unused imports