This commit makes sure that the `ApplicationContext` is closed properly if an `ApplicationReadyListener` throws an exception. Closes gh-12549
This commit makes sure that the `ApplicationContext` is closed properly if an `ApplicationReadyListener` throws an exception. Closes gh-12549