Currently there's no known way to achieve this using our platform. We track Outlook add-in feature requests on our [user-voice page][1]. Please add your request there. Feature requests on user-voice are considered, when we go through our planning process.
[1]: https://officespdev.uservoice.com/forums/224641-general/category/131778-outlook-add-ins
Currently OfficeJS does not support TaskPaneClose event. We track Outlook add-in feature requests on [our user-voice page][1]. Please add your request there. Feature requests on user-voice are considered, when we go through our planning process.
[1]: https://officespdev.uservoice.com/forums/224641-general/category/131778-outlook-add-ins