Test session write close & session generate id