The getting caught is intentional. Molesting Samarra and Nell works differently than the other girls. You have a set number of "action points" you can used, based on your agility. With the current maximum agility in the game, that's 11. Most actions you take use 1 action point, but some, such removing the covers or moving a girl, take more. When you reach 0, Samarra catches you. In a way, Samarra catching you the first time is a good thing, since you come to an understanding with her. Subsequent times, though, it does cause her opinion of you to lower. Still, since there isn't any followup to the sleep molestation yet, I decided to have you get caught both times so you could try every currently available action and to demonstrate how it works. If you don't want to get caught, just do one action less and chose to leave.