handle errors resulting from documents that are closed before we ask about them

The "Share on Behance" plug-in blocks ExtendScript while it executes. It also creates and then closes a document.

We don't properly handle the case where a document is opened and then closed before we get around to asking about the document.

This PR fixes that bug.

cc @iwehrman @jhatwich