Close dialog if button was clicked not just pressed

Click on close button and hold mouse button - the dialog closes, however, one expects that the dialog stays open (until one releases the mouse button on the button element).