This prevents dangling pointers as the light structures that the pointers in the state->lights array point to are freed below when cleaning the light maps.