Allow process to exit if an exception is thrown during shutdown
This branch makes the LifecycleManager more robust:
- Exceptions thrown during shutdown no longer prevent the shutdown latch from being released, and therefore don't prevent the process from exiting
- The semaphore guarding the startServices() and stopServices() method is removed, in favour of returning early if these methods are called in the wrong lifecycle state
It would also be worth testing the following scenarios to check for regressions:
- Sign in, then sign out immediately, before Tor has finished starting. Check that the app eventually shuts down and can be relaunched.
- Sign in, then force stop the app. Check that the app can be relaunched.