Regarding the last question:
I'm not quite sure I fully grasp the relationship of classes to nodes yet.
But as I understand, this error comes up when there are class instances initiated with the new() method that don't get cleaned up at the end.
E.g. in a script
Chest.gd, that is attached to a node:
const Potion = preload("res://Potion.gd")
my_potion = Potion.new()
It looks like instances that aren't attached to a node, like
my_potion, won't get cleaned up automatically.
You need to do it manually like so:
_exit_tree will automatically be called on quit, if the script that contains it is attached to a node, like
Chest.gd in this example.
It will, however, not be called, if you put it into
Potion.gd itself, because that script has never been in the tree in the first place, as it wasn't attached to a node.