Deal with client disconnects and robustify signal handling