Spigot's patch: Properly close inventories when unloading chunks and swithing worlds

For fix dupes with minecarts and unloaded inventories