Added closeInventory() function