Fix a Reference/Memory Bug in TreeSortable

This commit ensures that a reference to the sort function remains in go,
so that the garbage collector doesn't free the space.