Add ability to close socket