Adding in an onClose hook for modal

This allows us to be able to run arbitrary code before hiding the
modal dialog.