added: onClose & onBeforeClose options