Wait until response is finished before exiting

Change-Id: I74f5636aba06e1fde10ede2764f2cfc9f6c7a8fa
Merge "Wait until response is finished before exiting"