Installs a close handler for the window.
Future<void> onClose(FutureOr<bool> Function() handler) { return _platform.onClose(_id, handler); }