Pass on cancel event to the window shutdown handler

Fix for cancel button not being obeyed: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-5327

TBR: @Benglin @ikeough