moved WDPDialogClose to after button declaration