make amd friendly
add onClose option which is a function that will be called when dialog is closed