Fix a space leak in package preferences (part of issue #3824).
The space leak was introduced in #3594. #3594 added a new variable, sortedVersions, to sort the subtrees under package choice nodes in the search tree. However, sortedVersions referenced the subtrees and caused them to be retained when it was not used. This commit forces evaluation of sortedVersions.