destroy session when destroying the editor

fixes #1652 and #344 
This also allows to do `editor.setSession(null)` to prevent session from being destroyed.