[AS7-5439] send response before closing the channel
[AS7-5439] wait for operations to complete before shutting down the server