Implement asynchronous shutdown mechanism for client
Fix bug where handler for a response was always removed after the request is
sent.
The client is now receive the response from the server after a build.