fix socket close bug