I can only think of a couple times when my tires went flat when the bike wasn't moving, probably from little pieces of debris which caused a slow leak.
Had lots of flats while riding over the years. Be calm, don't panic, don't overcorrect your steering, keep the bike straight, don't hit the brakes too hard, slow down easily.