handle client disconnection without crashing