They continue to fly around the light bulb because there is heat being emitted from the light bulb, even though it has been turned off. Moths and other flying insects are attracted to both light and heat. Once the heat has dwindled away, the insects will look elsewhere (usually its the nice warm human lying asleep in bed).