I found same problem when i use form X button on forms right hand corner.
"An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
Additional information: Value Dispose() cannot be called while doing CreateHandle()."
I try this solution and it works
I found 'form' property of "Cancel Button" which assign as 'None'.
I add new exit button and do exitbutton_click event In that i call function as
this exitbutton i link to 'form property Cancel Button'
It works well when i click on form X button.