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.