close

fun close()

Closes the GUI for the player by closing the inventory, unregistering the GUI listener, destroying any providers in the structure, and unregistering the GUI from any virtual inventories. This method is called when the player closes the inventory or when allowClose is true and the player attempts to close the GUI. It ensures that all resources associated with the GUI are properly cleaned up to prevent memory leaks or unintended behavior after the GUI is closed.