fix session#isclosed
refactor