SDK leaves goroutines running after closing

Details

Description

When calling the `Close` method on an agent, it does not wait for the shut down to be completed. For a short period of time, a number of goroutines and sockets are still open, this makes it difficult to accurately determine if there are any leaks occurring in the SDK. We should block on Close waiting for the SDK to completely shut down, and all goroutines should watch for the client shutting down so they may react immediately.