Fixed crash when closing an open index.