Don't ping when socket closed by open handler

Partial fix to issue #160.