Packaged the lights properly. Freed cudaLights and cudaMats in order not to leak memory.