Figurative: To suddenly stop talking or refuse to speak, typically due to a particular reason. Usually because you are embarrassed or nervous, or do not want to talk about a particular subject: "He just clams up if you ask him about his childhood."
Literal: The phrase refers to a clam closing its shell.