replace finalize with item-local storage
replace finalize with item-local storage

This patch replaces weakref.finalize, which resulted in a poorly understood
memory leak, by a similar construction that adds the weak references to the
cache item rather than a global registry. The main difference is that when a
cache item is removed all callbacks are removed along with it.

wijnandhoitinga/nutils