Closing menus with spacebar will still send certain assigned actions through afterwards
If the user assigns either "Jump" or "Inventory" to the spacebar key and then pushes spacebar to close out of an in-game menu the assigned action will still be processed immediately after the menu closes.
In the case of assigning "Jump" to the spacebar, once you have closed out of the inventory of a container by using spacebar your character will jump immediately afterwards.
With "Inventory" assigned to spacebar, pushing it to close out of a menu instead brings up your inventory first. Then a second push of the spacebar closes out of the menus.
My suggestion would be to just always make the "Activate" key close out of menus rather than spacebar. That would feel most natural to the user IMO. ( I.E. Pushing the activate key on something can both bring-up and close-out of menus.)
The activate key on an open container is used for "take all and close the container". That behavior is actually undesirable, as anyone knows who's accidentally double-pushed the activate key when opening some enormously full loot chest or closet and had to spend an hour cleaning out their inventory again. It should actually be a different key that does "take all and close". Or at least an option we can set, even if if the default remains to mimic the Bethesda engine behavior.