Fix potential race condition with nulling out Dialog/Inspector fragment

We can't set this.fragment = null; after calling the parent's close method,
because the closing operation may be asynchronous (that's why it returns
a promise!) and some of the deferred steps may use this.fragment.

Instead, null it out after the closing process has finished.

Change-Id: Icb5919616c33f4b769489b521e1a17f54a0b6649
Merge "Fix potential race condition with nulling out Dialog/Inspector fragment"