Doctors use stethoscope to hear the sound produced during each cardiac cycle. The second sound is heard when: