Handle sessions where the kernel has been killed
Fix failure message for tests
Fix 404 error when accessing nonexistant session
Correct comment
Add tests and fix some issues

Tests taken from #6360
Merge pull request #6412 from takluyver/sessions-rest-api-fix

Sessions rest api fix