I had some problems saving and closing files

I had some problems saving and closing files.

When I close a file with the following code, a dialog box always pops up. How can I close the file without saving?

app.activeDocument.close();

How to set the image quality when using the API provided by uxp for saving files?

app.activeDocument.save(EntryFile, {embedColorProfile: true });

Regarding the close document, you can use this descriptor in a batchPlay call:

export function closeDocument(save: boolean = false): ActionDescriptor {
  return { 
    _obj: 'close',
    saving: {
      _enum: 'yesNo',
      _value: save ? 'yes' : 'no',
    },
    _options: {
      dialogOptions: 'dontDisplay',
    },
  }
}

e.g:

photoshop.action.batchPlay([closeDocument()],{}) // close and don't save
photoshop.action.batchPlay([closeDocument(true)],{}) // close and save

Thank you very much. This is the code I use now