[plugin] fix init of plugin, (only run once at startup, and make sure settings are saved on close)