attempting to handle proxy server shutdown more robustly