fix memory leak with keep alive connections which are closed by server