Delete TLS streams before deleting the session

The streams depend on the session and can crash the program if they
are removed in the wrong order. Do a general cleanup of the life time
management of the streams.
4 files changed