to trap sth by closing a door, lid, etc. on it
shut sth in sth
Sam shut his finger in the car door.
Definitions from the Oxford Advanced Learner's Dictionary, 9th edition