heapsort cleanup