add MayCloseWindow for guarding CloseWindow