Quite simply it's because that's when there is the most betting activity - the majority of the activity, actually.
Odds start at what the bookmakers believe is an accurate representation of the outcomes. These odds then drift or come in depending on what the punters are backing. For example, a team might be 10/1 to win when betting opens. If millions are bet on that then the odds will shorten. It's not unheard of for odds to change massively in the time leading up to an event.
Consider, a football match: if a lot of money is placed on team A, the odds for team A shorten; if a lot of money is placed on team B, the odds for team A lengthen.
So now you ask: why does the majority of the activity happen just before the event?
1 - The big betters want to keep their cards close to their chests.
Say I was a professional gambler and I had really investigated the statistics and other parameters surrounding an event. Mythical United are playing Made-up FC and Made-up FC have been set at 1/1 or evens. However, I happen to know that Mythical United are not playing four of their strongest players due to a sickness virus in the club and will be at a severe disadvantage. If I bet £1,000,000 five hours before the game then that is when the odds will change. Because of that, everyone else will see the change of odds and might think "Oh, I'm getting some of that!" It's a crude example but the sizeable bets are generally placed around 10-15 minutes before the event and that is why the market appears to "correct" itself.
2 - You get better value closer to the event.
The bookmaker will have more liquidity the closer it gets to the event. For this reason, it is easier for the big boys to get large bets accepted.
3 - You're more likely to get the true odds.
It does happen - bookmakers and punters will "seed" the market so that odds are more tempting. In horse racing you'll often see a horse at 30/1 come in to 12/1 in the build up but then drift massively out closer to the event. You can avoid falling victim to this manipulation by betting late.