fixes a potential NullPointerException when session is destroyed
Merge pull request #1361 from klieber/topic/session-destroy-npe

Fixes a potential NullPointerException when session is destroyed