move shutdown calls into check for ssn->ssl. Found by PVS-Studio