We can use the below code to close the current analysis result and analyze the new filed. The setting file must be created by clicking the Save button.
Stngs$="C:\Users\yuan.chen\Documents\Zemax\Configs\TFM.CFG"
CLOSEWINDOW WINL()
MODIFYSETTINGS Stngs$,TFM_FIELD,3,"TFM"
Openanalysiswindow "tfm",Stngs$