Cleaned up location of init and free for some programs to prevent memory
leaks on incorrect arguments
diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c
index 952d17c..b4fc450 100644
--- a/programs/x509/cert_write.c
+++ b/programs/x509/cert_write.c
@@ -113,9 +113,12 @@
         return( -1 );
 
     if( fwrite( output_buf, 1, len, f ) != len )
+    {
+        fclose( f );
         return( -1 );
+    }
 
-    fclose(f);
+    fclose( f );
 
     return( 0 );
 }