Client close null ptr exception fixed