Fix UnboundLocalError in write_proxies.py