diff --git a/inc/auth.php b/inc/auth.php
index fa087e8f6b0a04bcf426dcda78393219c0e6a130..e1f9029a90199cd487053b93242c60bd2df1a3d4 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -276,7 +276,7 @@ function auth_logoff($keepbc=false){
   global $INFO, $ID;
   global $auth;
 
-  // reopen session
+  // make sure the session is writable (it usually is)
   @session_start();
 
   if(isset($_SESSION[DOKU_COOKIE]['auth']['user']))
@@ -300,9 +300,6 @@ function auth_logoff($keepbc=false){
   if($auth && $auth->canDo('logoff')){
     $auth->logOff();
   }
-
-  // close session again
-  session_write_close();
 }
 
 /**
diff --git a/inc/common.php b/inc/common.php
index 817e416b0d0e679f704106d41bec456fcfbf1725..46d0002dfdb0d7b77b1d7eee952f391dc4c58b7f 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1463,6 +1463,9 @@ function is_mem_available($mem,$bytes=1048576){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function send_redirect($url){
+    // always close the session
+    session_write_close();
+
     // check if running on IIS < 6 with CGI-PHP
     if( isset($_SERVER['SERVER_SOFTWARE']) && isset($_SERVER['GATEWAY_INTERFACE']) &&
         (strpos($_SERVER['GATEWAY_INTERFACE'],'CGI') !== false) &&