I don't understand your goal. You may play sound for some time and then stop it. Considering your code you begin to play sound and immediately stop it and end the program. What the behavior you expected?