If you are using PHP 5 and a database class and storing sessions in the database, unfortunately, there is a chicken & egg problem. By default sessions are closed and written after objects are destroyed, so the session handler can't access objects (at least not to write or close the session). This also creates the problem that if the session handler is an object, then when it goes to close out, it won't be able to because the session handler object won't exist anymore.
The way I avoid this problem is by doing an explicit session_write_close() at the end of the file and then close the database connection and exit the script. This ensures the session handler has access to objects, including the database connection. And I also force my session handler to call static class methods instead of an object. However, calling session_write_close() before the script ends you might be able to use an object as a session handler, but I haven't tested it.