SERVER-8707 Stop the ReplicaSetMonitorWatcher loop on process termination

Use StaticObserver to end ReplicaSetMonitorWatcher's loop when a program
using the C++ driver exits.  Move the sleep to the bottom of the loop to
reduce the window between checking for termination and the call to
ReplicaSetMonitor::checkAll().