handle dead proxy refs in nodetree cache

I had thought that `not wid` would handle dead references, as `wid` becomes a proxy to `NoneType`, but in fact `not wid` raises `ReferenceError`!!

````
ipdb> wid
<weakproxy at 0x7f3c35b35158 to NoneType at 0x920190>
ipdb> wid.parent_node
*** ReferenceError: weakly-referenced object no longer exists
ipdb> not wid
*** ReferenceError: weakly-referenced object no longer exists
````