Fixed startup and shutdown for application with async event loop