Clam up

To close one’s mouth, to shut up, to stop talking.

The students clammed up when they saw the teacher.