Fixes #9943. Adds support for forceClose

close API can be called without triggering the beforeClose event.