Only close last opened dialog when clicking Close button