I'm assuming you're using the SCLogin module, but if not, let me know.
The logout process is handled by Joomla itself. We send the user to the standard com_users logout controller. The only way that I can think of that we'd be causing a 500 error is if we're somehow generating the logout redirection URL incorrectly. The code for doing that is in the /modules/mod_sclogin/helper.php file around line 66 in the getLoginRedirect($loginType) function. That will generate the base64 encoded URL that will be used for the logout. I'd check the URL created there to see if it's create.
Let me know if that helps narrow things down, but if not, we'll help how we can.
Thanks,
Alex