lock
To fasten something shut so that only a key, code or catch can open it. Also: to hold or become fixed in place, to shut someone in or out, or to settle something for certain. As a noun: the device that does the fastening, a gated chamber on a canal, a sure thing, or a piece of hair.
Tell
a key or code keeps it shut
Best when
You mean fastening or fixing something firmly and do not need to say how, by what device or for how long.