It's like a clam shutting its shell tight – it becomes completely closed off and unwilling to communicate.
Here are some examples:
* "When the police questioned him, he clammed up and refused to answer any questions."
* "She clammed up when I asked her about her relationship with her ex-boyfriend."
* "The witness clammed up in court, making it difficult to get a clear picture of what happened."