'Cmd+W' always closes the main application window, even if the focus is in a (docked, undocked or floating) dialog: to close the dialog, one has to use 'Ctrl+W'.
'Cmd+W' always closes the main application window, even if the focus is in a (docked, undocked or floating) dialog: to close the dialog, one has to use 'Ctrl+W'.