Added resilience when stopping and restarting proxy server