closes socket