moved callback to release session to after we have cleared the session
Merge pull request #1002 from snevesbarros/release_session_fix

Minor fix to clear session before releasing the session