Use NSWindow's begin/endSheet instead of NSApp's