gracefully handle client disconnects