Add session close before redirect
Remove unneeded debugging