[Memory] Fix leak in typesystem.
[Memory] One last miss in TypeSystem.
[Memory] Don't keep these variables in scope forever.

TODO: Fixme!
[Memory] Don't keep these references on cleanup.

We leak Documents and stuff.
[Memory] Fixup CurrentSolution being kept in memory.