Check if session exist when logging out.

issue3344
review1040002
Clear taghandler at closing of the tag

issue3348
review1047003