fixed bug with closed session causing crash