Added code to close the dialog when the body is clicked.