Add on_request_close event to window to check before the window is closed

This replaces #1698.

* I added a `on_request_close` event which gets dispatched before we want to close the window. If it returns `True`, the window will not be closed.
* @tito suggested to use the `on_close` event. The problem with that is if someone uses that event to turn things off, what if they turn things off, but then the next callback returns `True` and the window is not closed after all and they are now in a unexpected state. So I think making a dedicated event for it is better. Plus it keeps backward compat.
* I also added the `on_request_close` event when the escape key is pressed. This does make kinda make the `exit_on_escape` config key somewhat redundant, but I left it there for backward compat. I don't think it'll hurt having both `on_request_close` and `exit_on_escape` options.
* When the `on_request_close` originates due to a keyboard escape key press, the `on_request_close` event also dispatches a keyword argument of `source='keyboard'`. This will allow the user to differentiate why the window wants to be closed; whether due to the escape key or due to the user pressing the red X and handle them accordingly.