close session in PrepareToDie

this fixes a segfault, as in dtor the referenced session may already be invalid