Demo create window and handle window close event.