Clams have mantles. The mantles have light receptors which detect even the faintest change in light, which includes shadows from the side. If you stand in front of the tank and you happen to create a shadow, the clam can detect it and close up as if it were spooked. Then a few seconds later, it will open up again.