In the example:

Harry had torn open the parcel to find a thick, hand-knitted sweater in emerald green and a large box of homemade fudge.
"Every year she makes us a sweater," said Ron, unwrapping his own, "and mine's always maroon."
"That's really nice of her," said Harry, trying the fudge, which was very tasty.
His next present also contained candy -- a large box of Chocolate Frogs from Hermione.
This only left one parcel. Harry picked it up and felt it. It was very light. He unwrapped it.

'This' refers to the unstated but implied act of opening the second present.

He opened the first parcel.. This left two parcels unopened.
He opened the second parcel. This left one parcel unopened.
He found that the third parcel contained candy. This left no parcel unopened.
This tells us there were three parcels.

Your example can't be better! Thank you.