Omniverse App does not seem to shutdown properly when clicking close button

When I run something like this:

import omni
app = omni.isaac.kit.SimulationApp({"headless": False})
while True:
    app.update()

The omniverse app doesn’t seem to be shutting down when I click the close button. I have tried both Isaac 4.1.0 and 4.2.0 but neither seem to be working.

If I subscribe to the shutdown stream:

shutdown_stream = omni.kit.app.get_app().get_shutdown_event_stream()
sub = shutdown_stream.create_subscription_to_pop(cleanup_callback, name="pre-shutdown", order=0)

This callback does get called when I click the close button on the app, but nothing happens afterwards.

One interesting thing is that if I launch isaac sim via the omniverse launcher, this close button would work as expected.

Am I missing something when instantiating the simulation app?

Any help is appreciated! Thanks!