added close socket method