Fix jpeg write tag failure.
Discard data in commitChanges instead of saveAttribute.
diff --git a/main.c b/main.c
index be926e0..f0bc9be 100644
--- a/main.c
+++ b/main.c
@@ -345,8 +345,6 @@
     LOGE("returning from saveAttributes");
 #endif
 
-	DiscardData();
-
 // Temporarily saving these commented out lines because they represent a lot of figuring out
 // patterns for JNI.
 //    // Get link to Method "entrySet"
@@ -425,6 +423,7 @@
     const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL);
     if (filename) {
         saveJPGFile(filename);
+        DiscardData();
         (*env)->ReleaseStringUTFChars(env, jfilename, filename);
     }
 }