He can see the dragon perch itself on a nearby roof as it looks for him and so he uses the opportunity to begin maneuvering himself to a more stable position. This draws the dragon attention to him though. It suddenly leaps onto his roof, using its massive talons to dig into the roof to keep it steady as it slowly crawled towards him. He just barely manages to grab his broom as the dragon snaps its jaw forward, forcing him to let go and destroying the ledge he had been clinging to. 