What kind of clam is it? Clams feed off of nitrates and ammonia, though you don't usually want above 5 ppm or thereabouts detectable in your tank. How long have you had the clam as well?
If it keeps falling off the rock, you don't want to continue putting it back in the same spot. If you are determined to keep the thing in one specific spot, you could cut a 1 inch tall piece of PVC piping that is about 1/4" larger then the clam would be when it is fully open, place it around the clam to get it to stop falling over. I have done that about 500 times. Issue is that you have to cut it JUST right and the clam can still "crawl" over it if it's really that picky. Maximas and Croceas like a LITTLE bit of higher water flow, so you might want to try aiming it's incurrent siphon towards a powerhead but NOT at it. The clam will usually turn a specific direction and show you where it wants to be aimed.
As for is slamming shut, you don't want it to happen that much. It is showing that the clam is healthy because it is reacting to light (assuming it still has it's byssal organ). Their mantle is covered with hundreds if not thousands of "eyes" that they use to detect light and shadows. But one way to test if a clam is healthy is by waving you hand over the tank (in this case a fish) and see if it closes because of the shadow. Only problem is if it continues happening, you MIGHT want to move the clam out of this fishes territory because it takes a TREMENDOUS amount of effort to shut and stay shut. Acclimating a new clam can stress it out very much if it has to keep closing. Anything in the tank that is crawling on the shell?