add more events to close the plugin