code: func (tr *TaskReaper) Stop() {
  	tr.closeOnce.Do(func() {
  		close(tr.stopChan)
  	})
  	<-tr.doneChan
  }
docs: // Stop stops the TaskReaper and waits for the main loop to exit.
  // Stop can be called in two cases. One when the manager is
  // shutting down, and the other when the manager (the leader) is
  // becoming a follower. Since these two instances could race with
  // each other, we use closeOnce here to ensure that TaskReaper.Stop()
  // is called only once to avoid a panic.