My case is different, it fails because of the scope of 'this':
//this fails:
$("#My-Dialog").dialog({
...
close: ()=>{
$(this).dialog("close");
}
});
//this works:
$("#My-Dialog").dialog({
...
close: function(){
$(this).dialog("close");
}
});