This PR is looking pretty clean and straightforward to me.  I'm not certain, though, whether we should be doing anything additional to notify the TaskScheduler about what is going on during this shutdown process.  @kayousterhout ?