This is probably because the data on the form has been modified prior to executing the CRM Dialog.
You could try modifying the WatchDetailsWindowForClose function:
function WatchDetailsWindowForClose() {
if (!popup || popup.closed) {
/// Do your stuff here....
clearInterval(detailsWindowTimer); //stop the timer
if(Xrm.Page.data.entity.getIsDirty() == true) {
Xrm.Page.data.entity.save();
} else {
window.location.reload(true);
}
}
}