I see.
I just tested here and it does not matter what keyboard combination I assign to "Close Window", be it '2' or 'Shift-P', it works as expected and closes the top window.
Do you have any other utility that may be messing with your key commands on your systems?
If not, try to quickly create a new user on your Mac and see if the key commands behave for that user?