If the closing handshake is asynchronous, you can return a promise so the user knows when it completes (or fails). This could be as simple as "Return a promise that will be resolved when the closing handshake completes successfully, or rejected with some kind of error if it fails."