Added ability to call a function on dialog cancel