fix(peer/heartbeat): avoid unlimited wait on stopHeartbeat

It could happen now if two threads call stopHeartbeat at the same time.

Fix the test error in etcd