wp_logout without redirect

I am creating my own login page, and checking if the user is logged in. If so, calling wp_logout before rendering my page.

This works, but I do get warnings as WordPress is trying to redirect me. Cannot modify header information

I cannot find a way to simply logout, and carry on. Is there a way to do it, or a reason why this is so hard?

Many thanks