Closes PR 14651

There was a problem with heap-remove-index! that made it only really work with index 0. This should fix it. I added random testing of the heap invariant.