Add a ShutdownState type in the compositor

Currently the compositor tracks its state in the processing of shutting
down with two boolean instance variables `shutting_down` and `done`, but
these two variables really implement a three-state abstraction.
Merge pull request #2767 from zwarich/shutdown-state

Add a ShutdownState type in the compositor