Input (grade 7): As they leave, he locks all the bedroom doors to prevent the intruder from escaping.
Output (grade 7): As they leave, he locks all the bedroom doors to stop the person in the cupboard from escaping.