Ensure that the session is dereferenced on close