Fix bug #6542 (Exception thrown on save if file not visible in project
tree) - move initialization of wasOpen after the check that early-exists
when $directoryNode is null.
Merge pull request #6545 from adobe/pflynn/fix-tree-npe

Fix bug #6542 (Exception thrown on save if file not visible in project tree)