Socket Hangup error in between of test execution and it will not proceed further

Hello, could you please explain how to kill the node instance within the testing script

Scenario
If there is multiple iteration or parameters in test case, then after executing some parameters, I will get issue of Original error:
Could not proxy command to remote server. Original error: Error: socket hang up in katalon studio.
I applied Delay keyword but still after executing some parameters it throws same exception.

After applying AppiumDriverManager.getDriver().quit it throws an exception
Session ID is null. Using WebDriver after calling quit()

Any solution?

I have already updated Appium version i.e 1.17.1

For Android, you can use the code below:
public static void deleteNodeExe(){
println("[LOG] ==> Checking if node.exe is running…")
String namePC = System.getProperty(‘os.name’)
if(namePC.contains(“Windows”)){
boolean node_exist = Utility.checkTaskList()
if(node_exist == true){
println(“node.exe still exists since last session! Going to stop it…”)
try{
Runtime.getRuntime().exec(“cmd.exe /c start taskkill /IM node.exe /F”)
sleep(5000)//sleep a little bit to finish killing the process before going to other step
}catch(Exception ex){
ex.printStackTrace()
}
}
}
}

Hope it helps you!