A sailor quickly learns the right way to gybe a mainsail: Trim the mainsheet carefully, and always keep the boom and sail under full control. But in all the moving around, the headsail, often a genoa, tends to be forgotten. Unless you have a crew of eager sailors in search of a permanent job, that's usually a good course of action. Do nothing with the headsail until the mainsail has been successfully gybed and the mainsheet eased to the proper point.
If the headsail becomes slightly backed after the gybe has been completed, not much harm will be done on a downwind run. Once the boat and crew have settled down after the gybe, it's easy enough to trim in the new jibsheet and simultaneously ease out the old one. But letting both sheets fly at the moment of the gybe is not the best way to proceed. Not only can the eased sheets quickly complicate the gybing maneuver itself, but when both sheets are eased a lot, there is a reasonable chance that the body of the sail will be blown forward and wrap itself around the forestay. So unless you have an excess number of helping hands on board, get the mainsail over first and follow up at your leisure with the headsail trim.