Added more handling for null references.

During testing we found that NullReference exceptions could occur during async callbacks. This is an attempt to resolve those issues. I also made changes to clean up the SSL stream on close. In our testing we've eliminated the NullReference exceptions when using SSL & TCP sessions.