make sure script exits when proxy is inaccessible

closes #376