Make sure _liveDocument exists before dereferencing

I discovered this while researching #5774 (but it's not a fix for #5774).

When `_liveDocument` is undefined, then this code throws an exception, and else clause is never executed, so deferred is not resolved. This could be causing some of the random hangs we see in Live Development.