Add the logic to wait for an app to become stoppable
Tests for stoppable
Tests for the new state transitions