close the survey at the correct time