Merge "Check client null before calling and closing." into main