Adding in an onClose hook for modal

This allows us to be able to run arbitrary code before hiding the
modal dialog.
Merge pull request #52 from peaches/ak-fix_popup_not_resetting_properly

Adding in an onClose hook for modal