session close before redirecting