feat(popup): Support for programatically closing popup. Fixes #854