It's a question I see every now and then: what's the worst story about getting caught having sex that you have? Not happening, if for no other reason than the woman involved is still embarrassed about it. On the other hand, having had this happen to me, I can offer some valuable advice if you do get walked in on. No, seriously. Once you realize something's wrong, stop. Before you ask, yes, I've known people who haven't, and it turns something awkward into something mind-scarring. Secondly, Say "Do You Mind?!" To be fair to the person who has just walked in on you, they probably should have pulled a 180 and closed the door quietly, but some people's brains shut down when confronted with something like this. A sharp question will get it into gear, and hopefully get them out the door. If not, you may have to yell at them a bit. Either way, they need to leave.
Thirdly, Clean Up and Cuddle Like it or not, whether it's your landlord blundering into your bedroom because you forgot he was coming to fix the radiator, or an Eagle Scout troop coming across you on a mountain trail (long story), the moment's done, so you might as well stop and at least share a few affectionate moments. Finally, Damage Control Normally, the person who walked in on you will be embarrassed and a quick "Let's keep this between us, OK?" will be enough. Other times, you might have to get a little hostile, or a little creative. If it's a gossip, you might want to make clear you know exactly who would be blabbing about this, and that you can get creative with the payback.