Tape or something similar is a good suggestion. As is a spare.
It fell off in the normal course of shooting. No impact, wasn't intentionally opened - nothing. I had it previously fall off in my camera bag so it was not unexpected. Obviously it was bumped or something, but it was the same kind of activity I have with 5 other DSLR's that have never once had the issue. It happened twice on the D800E.