Not before launch, during launch.
The structure of the payload bay (and the other Orbiter compartments except for the crew compartment) was not strong enough to withstand either crush loads from a vacuum in the bay / atmosphere outside situation, or burst loads from a atmosphere inside / vacuum outside situation. Accordingly, the bay and other volumes were vented through a system of doors and ducts. This system was called the Active Vent System (AVS).
The doors were opened and closed by electric motors commanded by the onboard computers.

The doors were either closed or slightly open ("purge position") prelaunch to prevent intrusion of any propellant vapors into the bay - some compartments were being purged by dry air supplied from the ground. Before launch, all doors were commanded fully open.
The flight sequence of operations was as follows:
The vent door opening sequence is automatically initiated at T - 28
seconds. The vent doors are commanded open in a staggered sequence at
approximately 2.5-second intervals. At T - 7 seconds, the Redundant
Set Launch Sequence (RSLS) checks that all vent doors are open. If
any door is out of configuration, a launch hold will be issued.
As the vehicle ascended and the ambient pressure dropped, the atmosphere in the payload bay flowed out through the doors.
The doors remained open during ascent and orbit operations.
The doors were closed by the crew using commands input into the computers prior to the deorbit burn. Some of the aft doors then re-open to vent any vapors ingested during the burn. All doors automatically re-closed prior to Entry Interface.
During the initial part of entry, the doors remained closed to prevent plasma intrusion. When the vehicle reached Mach 2.4 (at approximately 85,000 ft altitude), the doors opened automatically to equalize the pressure by allowing the ambient air to flow into the payload bay.
The door sequence on ascent aborts was completely automatic.
All information about the doors comes from the Mechanical Systems Training Workbook. I urge you to consult this document for more information on the system.
This photograph shows some of the open doors.

Image source, annotations mine