invalidateLater: don't invalidate when session closed

I also looked at doing this by using `session$onSessionEnded()`. Because `invalidateLater()` can be called many, many times in a session, if it registered a cleanup callback with `session$onSessionEnded()` each time it's called, it would also have to clear the previous cleanup callback each time. I think this approach would need a function like `ShinySession$removeOnSessionEnded(id)`, and `TimerCallbacks$unschedule(id)`.

The approach I used here is this: when the `invalidateLater()` callback is called, it checks whether the session is closed.

Example usage:

```
shinyServer(function(input, output, session) {

  observe({
    # Re-execute this reactive expression after 1000 milliseconds
    invalidateLater(1000, session)

    # Do something each time this is invalidated.
    # The isolate() makes this observer _not_ get invalidated and re-executed
    # when input$n changes.
    print(paste("The value of input$n is", isolate(input$n)))
  })

})
```