private LRESULT WmDestroy( HWND hwnd, int uMsg, WPARAM wParam, LPARAM lParam ) {
			// call original AWT window procedure because it may fire window closed event in AwtWindow::WmDestroy()
			LRESULT lResult = User32Ex.INSTANCE.CallWindowProc( defaultWndProc, hwnd, uMsg, wParam, lParam );

			// restore original window procedure
			if( SystemInfo.isX86_64 )
				User32Ex.INSTANCE.SetWindowLongPtr( hwnd, GWLP_WNDPROC, defaultWndProc );
			else
				User32Ex.INSTANCE.SetWindowLong( hwnd, GWLP_WNDPROC, defaultWndProc );

			// cleanup
			windowsMap.remove( window );
			if( background != null )
				GDI32.INSTANCE.DeleteObject( background );
			window = null;

			return lResult;
		}
Handle WM_DESTROY

https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-destroy
flatlaf-natives/flatlaf-natives-jna/src/main/java/com/formdev/flatlaf/natives/jna/windows/FlatWindowsNativeWindowBorder.java