What happens to the pulmonary valve and the aortic valve when the ventricles begin to contract?

Aortic and pulmonary. When the ventricles begin to contract the aortic and pulmonary valves open when the ventricular pressure exceeds the arterial pressure on the far side of the valve.
They open. As the ventricles start to contract the mitral and tricuspid valves close. The pulmonic and aortic valves remain closed and the pressure inside the ventricles rise. When the pressure inside exceeds that on the other side of the valves, they open and blood flows across them. As blood leaves the ventricles, the pressure drops. When the pressure is lower in the ventricles, they close.