[XCUITest] Shutting down xcodebuild process

I keep hitting this problem while running iOS test scripts. Same test script worked earlier. I think it has something to do with environment or some process related to Appium. Any help/pointers are appreciated.

Here is the error in the log:

[MJSONWP] Calling AppiumDriver.elementDisplayed() with args: [“F22A4417-588E-49B3-A6D9-8634DB2B6394”,“f81ba073-a800-4ea7-a42c-e0afd02cd9b1”]
[XCUITest] Executing command ‘elementDisplayed’
[JSONWP Proxy] Got response with status 200: “{\n “value” : {\n\n },\n “sessionId” : “64782A70-D8C3-46A5-B22C-2353BD4E4BD9”,\n “status” : 0\n}”
[XCUITest] Shutting down sub-processes
[XCUITest] Shutting down xcodebuild process (pid 14255)
[JSONWP Proxy] Got response with status 200: {“value”:“Session does not exist”,“sessionId”:“64782A70-D8C3-46A5-B22C-2353BD4E4BD9”,“status”:6}
[BaseDriver] Waited for 616 ms so far
[XCUITest] xcodebuild exited with code ‘null’ and signal ‘SIGTERM’
[XCUITest] Shutting down iproxy process (pid 14254)
[XCUITest] iproxy exited with code ‘null’
[XCUITest] Found WDA derived data folder: ‘/Users/sgunna/Library/Developer/Xcode/DerivedData/WebDriverAgent-bmqtcbzxzfbnmmfegdcffhhwjyij’
[XCUITest] Setting ‘755’ permissions to ‘/Users/sgunna/Library/Developer/Xcode/DerivedData/WebDriverAgent-bmqtcbzxzfbnmmfegdcffhhwjyij/Logs/Test/Attachments’ folder
[XCUITest] Found WDA derived data folder: ‘/Users/sgunna/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy’
[XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on.
[iOSLog] Stopping iOS log capture
[Appium] Removing session f81ba073-a800-4ea7-a42c-e0afd02cd9b1 from our master session list
[BaseDriver] Event ‘quitSessionFinished’ logged at 1501219330358 (22:22:10 GMT-0700 (PDT))
[MJSONWP] Received response: null
[MJSONWP] But deleting session, so not returning
[MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/f81ba073-a800-4ea7-a42c-e0afd02cd9b1 200 1219 ms - 76
[HTTP] <-- GET /wd/hub/session/f81ba073-a800-4ea7-a42c-e0afd02cd9b1/element/F22A4417-588E-49B3-A6D9-8634DB2B6394/displayed - - ms - -
[HTTP] <-- POST /wd/hub/session/f81ba073-a800-4ea7-a42c-e0afd02cd9b1/element - - ms - -
[BaseDriver] Waited for 1118 ms so far
[BaseDriver] Waited for 1621 ms so far
[BaseDriver] Waited for 2123 ms so far
[BaseDriver] Waited for 2627 ms so far
[MJSONWP] Encountered internal error running command: TypeError: Cannot read property ‘sendCommand’ of undefined
at XCUITestDriver.callee$0$0$ (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/lib/commands/element.js:91:35)
at tryCatch (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at invoke (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at enqueueResult (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
at Promise.F (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
at AsyncIterator.enqueue (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
at AsyncIterator.prototype.(anonymous function) [as next] (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at Object.runtime.async (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
at XCUITestDriver.callee$0$0 [as elementDisplayed] (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/build/lib/commands/element.js:226:30)
at /Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:207:24
at tryCatcher (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/main/promise.js:510:31)
at Promise._settlePromiseAt (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/main/promise.js:584:18)
at Promise._settlePromiseAtPostResolution (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/main/promise.js:248:10)
at Async._drainQueue (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/main/async.js:128:12)
at Async._drainQueues (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues (/Applications/Appium 3.app/Contents/Resources/app/node_modules/appium/node_modules/bluebird/js/main/async.js:15:14)
at runCallback (timers.js:574:20)
at tryOnImmediate (timers.js:554:5)
at processImmediate [as _immediateCallback] (timers.js:533:5)