added lines to close socket fd's