When this._generator.getDocumentSettingsForPlugin(id, PLUGIN_ID) is called it does not handle error which might occur if e.g. document Is already closed. In that case generator process restarts and leads to the error in all plugins as they all are working in the same sandbox.
And I guess the same for .setDocumentSettingsForPlugin(settings, PLUGIN_ID).done().
I confirm, if you open some document and close it too fast, using any other plugin or even script – there gonna be an unhandled exception with "Unknown JavaScript error".
When this._generator.getDocumentSettingsForPlugin(id, PLUGIN_ID) is called it does not handle error which might occur if e.g. document Is already closed. In that case generator process restarts and leads to the error in all plugins as they all are working in the same sandbox. And I guess the same for .setDocumentSettingsForPlugin(settings, PLUGIN_ID).done().