Add hasattr guard around "pinger.close"