java.lang.AssertionError: Session disappeared. #2375

@damithc made the changes mentioned in the issue. Will need to test it out in actual situations to see if it helps though.

Fixes #2375 
Perhaps you can introduce local variables `questionCount` and `indexOfLastQuestion` to make this easier to understand. Otherwise it takes a while to get what's going on, even with the comment.