It's a nice quality of life to make the primary inventory key (E.G. Tab) close all menus and dialogs when one is open (while still serving the primary purpose of opening the inventory when no dialog or menu is already open) - it's a nice quality of life implemented by enough other games that it's a muscle memory that is already ingrained