What trick does johnny use to avoid losing his horse in the story Johnny Tremain?

I saw the movie many years ago when I was in Summer camp. It was not a Western and not generally about the Cavalry arm. I don"t recall such an incident, maybe he simply tied the animal up at a barn or the equivalent of a garage or coach-house.