Update client and server to wait to close before returning to avoid spurious allocator test failures.