[TIMOB-11698] Ensure window is open before trying to display gallery

Test is in [JIRA](https://jira.appcelerator.org/browse/TIMOB-11698)