fix connections when socket close and error