fixed close connection issues