AltSort: Replace sort with ExternalSort, Limit + sort with Limit + topN in the generated physical plan.
fix cleanup methods in ExternalSortBatch and TopNBatch.