ITS: move validate lighting image save after True return

files affected:
  utils/its_session_utils.py

bug: 218890201
Change-Id: I693482f3686ab14c8988ae620de6ef373b5c209d
diff --git a/apps/CameraITS/utils/its_session_utils.py b/apps/CameraITS/utils/its_session_utils.py
index f0f14f0..2a7c6f5 100644
--- a/apps/CameraITS/utils/its_session_utils.py
+++ b/apps/CameraITS/utils/its_session_utils.py
@@ -1267,7 +1267,6 @@
     boolean True if lighting validated, else raise AssertionError
   """
   logging.debug('Validating lighting levels.')
-  image_processing_utils.write_image(y_plane, f'validate_lighting_{scene}.jpg')
 
   # Test patches from each corner.
   for location, coordinates in _VALIDATE_LIGHTING_REGIONS.items():
@@ -1281,12 +1280,16 @@
         logging.debug('Lights ON in test rig.')
         return True
       else:
+        image_processing_utils.write_image(
+            y_plane, f'validate_lighting_{scene}.jpg')
         raise AssertionError('Lights OFF in test rig. Turn ON and retry.')
     elif state == 'OFF':
       if y_mean < _VALIDATE_LIGHTING_THRESH:
         logging.debug('Lights OFF in test rig.')
         return True
       else:
+        image_processing_utils.write_image(
+            y_plane, f'validate_lighting_{scene}.jpg')
         raise AssertionError('Lights ON in test rig. Turn OFF and retry.')
     else:
       raise AssertionError('Invalid lighting state string. '