How can I create a shortcut that just closes a window and not the RDP session

I unfortunately have to work in Microsoft Remote Desktop in order to run a program on my Mac. Also unfortunately this program opens multiple windows and my "command + W" keyboard shortcut closes the RDP session and not only the window in the Remote Desktop running program. I'm not sure I'm making myself clear but hopefully I am.

I cannot find anything in BBT that would allow me to create a shortcut through either keys or the TouchBar on my MacBook Pro that would close a single window in Remote Desktop and not the whole Remote Desktop program.

Please help.

Sorry I don't know. What shortcut would you use on the keyboard to achieve this? Does cmd+w work there?

Command + W closes the Remote Desktop session and not just a single window. When working in Remote Desktop the app is treated as a single window and not the window open within.

In windows you can close a single window using ctrl+f4 or alt+f4 to close a complete app. Maybe try assigning these shortcuts.

That was extremely helpful Andreas, thanks so very much, you've made my day.

Strangely, programming a BTT touchbar button to close window with "control + F4" worked for a while, but now suddenly stopped working. I've updated BTT and reprogrammed the button but to no avail. Anyone with any ideas why my BTT would suddenly stop working for the MS Remote Desktop Program?