In that case, since you should have access to the container object, I would attempt to do the check reachable and close the inventory.

(So no, don't rewrite it, try and use it first)