closes tcp socket