Move the avifCodecSpecificOptionsClear() call

In avifEncoderAddImageInternal(), move the
avifCodecSpecificOptionsClear() call after the last statement that may
fail, so that we can simply say that avifEncoderAddImageInternal() calls
avifCodecSpecificOptionsClear() before it returns AVIF_RESULT_OK.
diff --git a/src/write.c b/src/write.c
index 49c513a..f86bdd4 100644
--- a/src/write.c
+++ b/src/write.c
@@ -2121,10 +2121,10 @@
         }
     }
 
-    avifCodecSpecificOptionsClear(encoder->csOptions);
     avifEncoderFrame * frame = (avifEncoderFrame *)avifArrayPush(&encoder->data->frames);
     AVIF_CHECKERR(frame != NULL, AVIF_RESULT_OUT_OF_MEMORY);
     frame->durationInTimescales = durationInTimescales;
+    avifCodecSpecificOptionsClear(encoder->csOptions);
     return AVIF_RESULT_OK;
 }