@njx The problem is that when `FILE_SAVE` is executed below, the activeEditor has not yet been set. Instead of waiting to detect that, a more explicit fix would be to pass the Document to `FILE_SAVE` like:

```
    promise = CommandManager.execute(Commands.FILE_SAVE, {doc: DocumentManager.getCurrentDocument()});
```