Added check to ensure variable is assigned before being used.

This change fixes a bug that occurs when the user tries to open FileBrowser immediately after opening a new window.