Modal dialogs are hidden until fully loaded.

Also fixed ModalManager breaking during code initialization outside of
the app context.