prevent default on close dialog function