Close terminal after uploading in VS Code

Is it possible to configure PlatformIO and VSCode to close the terminal after finishing uploading.
I have tried with “runCommands” with no success. Here it looks like both commands are executed initially, or that the “platformio-ide.upload” commands finishes immediately even though the upload is still in progress.

        "key": "ctrl+u",
        "command": "runCommands",
        "args": {
            "commands": [
        "when": "pioProjectReady"