How do we know the presence of light when our eyes are closed?
Short answer, your eyelids does not block all light. Since they are only a thin layer of skin, the light is able to pass through although not completely obviously. Since the eyes are still completely functional when you close them, only covered by the eyelids, you are able to see when light strikes your face.