There are several long threads on the forum which discuss how to handle a horse which is bolting. I suggest you do a search and look them up.
A western rider will utilise the one rein stop - the English rider will pull back on the reins and try to bend the horse's neck onto its supple side. But neither is a good answer.
Far more important is for the rider to be in full control of the horse throughout the ride. Even an otherwise calm horse being ridden in a string of horses is prone to the mood and atmosphere of the group of horses. If one bolts then there is a good change that the other horses will be tempted to follow.
So the proper answer to your question is : don't allow yourself to be in a situation where the horse can take off, stretch its neck and snatch the reins from your hands. By all means talk to your companions but don't relax your concentration of steering and controlling the horse. And as for riding on a long loose rein rather than collected with a light contact with the horse's mouth - well you are asking for trouble - going out or coming home.
A horse which learns to bolt - out of gross disobedience is a danger to the rider and itself. It must be re-schooled and the rider must be taught how to keep the horse under control.
A horse which runs out of fear must be desensitised to whatever caused the fear, be it dogs, geese, pigs, donkeys - whatever.
Ambling along on a bright sunny day with a few companions is a delight, but that is just when a mischievious horse knows when to have some fun. If you come off at the bolt after being thrown off guard you'll hit the ground with force.
If you want to learn how to keep an excited horse under control - I suggest you talk with some local riders who go fox hunting. They will show you the tips - they have the problem from the moment the huntsman first blows his horn.