The requestClose() method of the HTMLDialogElement interface requests to close the dialog.
requestClose()
MDN Reference