I think it may be this line:
activeDocument.saveAs( saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
put a folder destination instead of the file location as the first parameter...
this is how I do:
//choose folder
var myFolder = Folder.selectDialog ();
//create new folder within chosen folder
var newFolder = new Folder(myFolder + "/newSaveFolder");
var exportFolder = new Folder(myFolder + "/newExportFolder");
newFolder.create();
exportFolder.create();
//create document
var myDoc = app.documents.add(10,10, 72, "exportOptions", undefined);
//save document in folder
myDoc.saveAs(newFolder)
similar but not exactly what u may want to do, still. Good luck.