I am not sure whether or not the quiz activity does this already for you.
In the quiz activity you can define a time limit. If you use a question from type "Essay", the user get a text editor to give his answer.
After the defined time is up. The editing is not possible anymore.