Teachers using quizzes which do not use the new (Moodle 2.3+) feature "When time expires...Close open attempts" asked to close the quiz attempts manually. (Actually, we had that feature since Moodle 1.9.2. And I will add a link to that code if anyone asks)
So here is a suggestion for a piece of code that "closes" (set quiz attempt to FINISHED) selected quiz attempts, by clicking a new button on the Quiz Overview report page.