If your lights flicker, or turn off and then on, for some unknown reason, this is often an indication of a loose wire connection or broken wire either at the light itself, the switch or at the home electrical panel. Ensure your lighting terminations are tight, properly grounded and that the switches are connected and installed properly in the recessed box. Make sure your terminal connections are not touching any bare metal.