Resolve the opened promise after teardown

Allow a window's teardown process to resolve/reject the opened promise
if desired, making it possible to extend the behavior of window without
wrapping the close method.

Change-Id: I47718a5bf7e7a96a268863a89fd070cdd91344b5