Batch Scripting Files

So I trying to create a little script,BatchProcessFiles(), that allows me to run other scripts on multiple files. This is what I have and it seems to work pretty good from small scripts, like the the BlockNameTest(). It seems to inadvertently just stop though, if I use a larger script, for instance one that makes2D for all the viewports of a file and turns then into blocks. Any help to stream line it would be helpful.

import rhinoscriptsyntax as rs
import Rhino

def BlockNameTest():
    BlockList = rs.BlockNames()
    for Name in BlockList:
        if rs.IsBlockEmbedded(Name) is True:
            Path = rs.BlockPath(Name)
            Index = Path.rfind("\\")
            Index2 = Path.find('.')
            FileName = Path[Index+1:Index2]
            if Name != FileName:
                Renamed = rs.RenameBlock(Name,FileName)
                print (Renamed)

def BatchProcessFiles():
    fileNames= rs.OpenFileNames("Pick Files To Process","RhinoFile(*.3dm)|*.3dm||")
    for a in fileNames:
        #Custom script Here
        rs.Command("-save _enter")



I’ve not used OpenFileNames or RhinoDoc.OpenFile so I’m not sure if there are any issues there. I usually run my scripts with a RunPythonScript command call from my script which works fine. The following is an example:

scriptName = ""
fileName = "Example_file.3dm"
rhinoPath = "C:\Program Files\Rhinoceros 5 (64-bit)\System\Rhino.exe" 
scriptCall = "-_RunPythonScript {0}".format(scriptName)
callScript = '"{0}" /nosplash /runscript="{1}", "{2}"'.format(rhinoPath, scriptCall, fileName)