Unless there is something wrong with the TreeView that is forcing you to do it this way, which I don't see, I really think you are not understanding the process.
If you flat out call the Free on the TreeView, It will send all of the nodes to the OnDeletion event for you to do any processing on them.
So, in your FormClose simply do this,
MyTreeView.Free;
and you're done.
what happens is the control will send each node to the OnDeletion event and that is where you then test for a non-nil pointer in the object and delete your record.
The final FREE process does not end until all nodes have been sent to the OnDeletion event. So this means you still can reference other items in the Control while this is taking place.
Granted that maybe the TtreeView should have a property to be tested indicating if the control is in the process of being unloaded so that you could tester more but That is something that can be done if needed. For example, you could use the TAG property to be set to a known value before you call the FREE, so that when the OnDeletion event is being called you can reference the TAG of the control to test for this condition.
Have a good day, whatever works for you at this point, I guess.