Gybing an yacht below 40ft or so in a light breeze, it is generally a waste of effort to pull in the mainsheet. Just gathering the parts and manhandling the boom across is perfectly safe. As the wind picks up, however, you’ll need to take precautions. Steer 10° or so off dead downwind, then heave the mainsheet right in and make it fast.
Now gybe carefully to a similar angle on the other side of the breeze. As the boom flops across, the boat will tend to luff. The trick of a sweet gybe is to counteract this with a nudge of ‘opposite helm’ to stop the boat’s tendency to round up. When things have stabilized, ease the mainsheet to trim for the new course. If it’s really windy, you’ll have to let out the sheet smartly to keep control.