Fixed #21448 -- Fixed test client logout with cookie-based sessions

Thanks Gunnar Scherf for the report and the suggested patch.