In my case, the tailgate is definitely tightly shut - it's been checked multiple times, including slamming really hard.
Did a 50 mile round trip yesterday. On the outward journey, the warning came on 5 or 6 times at random intervals. I didn't bother to stop and check because I knew it was tightly closed at the outset and wasn't making any rattling noises, and it was still tightly closed on arrival. On the return trip, not a peep from it, everything normal. So it looks like a sensor problem rather than a latch failure. Grrr, I hate intermittent problems!