the close event use main thread