While riding you get an current speed. This will be something like distance from last fix/time from last fix. This is what you are seeing as wrong when under cover. At the end of the ride you will get an average speed on the device display This will be something like total distance/total time (or total moving time if you have auto pause on).
I don't know anything about the inner workings of the Garmin, but I'm going to hazard a guess that once it gets a good fix again the inaccurate dithers in the track that it had while under tree cover won't have any significant effect on the total track length, and hence on the average speed.
And of course, once uploaded you're likely to get yet another different figure for your average speed, depending on which site you use.