How do I remove a widget from outside the widget blueprint?

I’m trying to remove the inventory widget from the player blueprint. The inventory closes and shows up fine but I don’t understand how to close the widget from outside the UI widget. I stored the widget in a variable try to remove it. Can anyone explain of why this does not work?

PS. for moderator when creating a topic it says “gallery title” that seem not right.

I tried the following but the event tick ofcourse closes it the moment I open the inventory with the initial TAB press…