L could have had plenty of time to wipe his hand if he was actually jacking off. Also it would be a hell of a coincidence if Light walked in just at that moment. Secondly, L was clearly lying down or something since he raises his head. I interpreted it as him trying to wipe away the germs, similarly to the L we see in the live action series. If he really somehow still had love juice on his hand he could have not made it obvious and wiped it afterwards, or wiped it whilst Light was walking towards him.