However, if you try to use the editor after destroying it, it's not working. Adding in a console.log(editor) after destroying it will give you
TypeError: null has no properties
You just have to manually remove the editor from the view.ui before destroying it.
setTimeout(() => {
alert("Editor should be destroyed");
view.ui.remove(editor);
editor.destroy();
console.log(editor);
}, 10000);