Saving to getDataFolder() still gives save dialog

Heya all, I’m working on a plugin that remixes a bunch of layer combinations, merges them down, and exports them automatically.
I previously had this working fine in old school photoshop plugin code, but I’m really struggling to get the exporting to work in UXP.
I’m trying to save to the DataFolder, which according to the documentation does not require user input.
(As I’m trying to export hundreds of files.)
But the save batch is just giving me a save dialog with a default location.
It is worth noting that the Document that this is being done is has not been saved before, as I’m using doucment.duplicate() to speed up my workflow. Could this be a problem?
Any help or pointers in the right direction would be useful!
My code:

async function savePNG(fileName) {
    var saveFolder = await require("uxp").storage.localFileSystem.getDataFolder();
    var saveFile = await saveFolder.createFile(fileName+".png");  
    console.log(saveFile.nativePath);
    const saveFileToken = await require("uxp").storage.localFileSystem.createSessionToken(saveFile); 
    await modalBatchPlay(
        [
            {
                "_obj": "save",
                "as": {
                    "_obj": "PNGFormat",
                    "method": {
                        "_enum": "PNGMethod",
                        "_value": "quick"
                    },
                    "PNGInterlaceType": {
                        "_enum": "PNGInterlaceType",
                        "_value": "PNGInterlaceNone"
                    },
                    "PNGFilter": {
                        "_enum": "PNGFilter",
                        "_value": "PNGFilterAdaptive"
                    },
                    "compression": 6
                },
                "in": {
                    "_path": saveFileToken,
                    "_kind": "local"
                },
                "saveStage": {
                    "_enum": "saveStageType",
                    "_value": "saveBegin"
                },
                "_isCommand": false,
                "_options": {
                    "dialogOptions": "dontDisplay"
                }
            }
        ], {
        "synchronousExecution": false
    });
}

I have temporarily solved this by invoking a JSX script with batchPlay that saves the selected layer to a chosen path.

For PNG, I have found this happens when the file has multiple layers and Photoshop has to do a “save as copy”. For cases with transparency, you can run steps first to delete all hidden layers and merge visible. In cases where there is no transparency you can just flatten the image first. I think you may have to delete alpha channels too if there are any in their but can’t remember for sure on that. You may also need to do a select all and then image crop if there are off canvas areas.

Once the file is a basic single layer without any off canvas pixels you then shouldn’t get the save dialog anymore.

The end result will be the same because PNG will only save as a single layer anyway. Without doing the manual steps to merge the layers, it does it automatically when doing a save as copy. By forcing these steps before saving though it avoids the save as copy pop up dialog.