addWillCloseListener method
Adds a listener that will be called when the session is about to close. The listener should return a FutureOr that completes when the listener is done.
The listener will be called in the order they were added.
Implementation
void addWillCloseListener(WillCloseListener listener) {
_willCloseListeners.add(listener);
}