To finish a quiz, first, go to the Results tab, and from there you'll see the Finish Activity button:
Click Finish Activity when you're ready to close the quiz. Students will now no longer be able to access it. You'll then be able to export reports. Learn more here.