In any controller method after you're finished writing session data. You can still get session data after you've called session_write_close but you can't modify it.
Code:
<?php if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
class Welcome extends CI_Controller {
public function index( ) {
// code that modifies session data
session_write_close( );
$this->load->view( 'welcome_message' );
}
}