Stop trial on correct answer only

I have the following code for a task I am trying to finalise:

check for quit:

        if "escape" in theseKeys:
            endExpNow = True
        if len(theseKeys) > 0:  # at least one key was pressed
            key_resp_9.keys = theseKeys[-1]  # just the last key pressed
            key_resp_9.rt = key_resp_9.clock.getTime()
            # was this 'correct'?
            if (key_resp_9.keys == str(Correct)) or (key_resp_9.keys == Correct):
                key_resp_9.corr = 1
            else:
                key_resp_9.corr = 0
            # a response ends the routine
            continueRoutine = False

However, what I really want is for the trial to only finish after the correct response has been selected. How can I achieve this?

Thanks