adding method to close socket and additional tests