Fixes Ssl streams closure issues