Appium Driver session closes before mobile tap is performed

Mobile tap request is posted to Appium server but pressing home button command is executed before executing this command

Node js Method:
CreateRecipePage.prototype.selectRecipe = function () {
var that = this;
return this.driver.elementByName(‘My Ristretto !23’).then(function(els){
try{
var tapOpts = {
duration: 3
, x: 0.5
, y: 0.5
, element: els.value
};
that.driver.execute(“mobile: tap”, [tapOpts]);
}catch(e){
console.log(e);
}
});
};

Appium logs:::
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=My Ristretto !23, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=My Ristretto !23, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“ELEMENT”:“24”},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“24”},“sessionId”:“b251e2bd-40ca-4c44-afd8-aac161c06540”}
info: <-- POST /wd/hub/session/b251e2bd-40ca-4c44-afd8-aac161c06540/element 200 21.170 ms - 88 {“status”:0,“value”:{“ELEMENT”:“24”},“sessionId”:“b251e2bd-40ca-4c44-afd8-aac161c06540”}
info: �[3
7m–> POST /wd/hub/session/b251e2bd-40ca-4c44-afd8-aac161c06540/execute {“script”:“mobile: tap”,“args”:[{“duration”:3,“x”:0.5,“y”:0.5,“element”:“24”}]}
info: [debug] Pushing command to appium work queue: [“click”,{“x”:0.5,“y”:0.5}]
info: --> DELETE /wd/hub/session/b251e2bd-40ca-4c44-afd8-aac161c06540 {}
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: /users/thivyalakshmieaswarasekaran/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell “input keyevent 3”
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“click”,“params”:{“x”:0.5,“y”:0.5}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][720,1280]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true}
info: <-- POST /wd/hub/session/b251e2bd-40ca-4c44-afd8-aac161c06540/execute 200 162.263 ms - 25 {“status”:0,“value”:true}

info: [debug] Stopping logcat capture

info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“OK, shutting down”,“status”:0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.

tap/click are asynchronous, you need to wait for the effect.