I got some code that shows me the window I tried to create. But closing it does not work. Neither the way described in the DialogSystem example nor trying to destroy the window makes it disappear
Pressing the X of the window corresponds to the FrameWindow::EventCloseClicked event, which is associated with the DialogSystem::cancel action. This action calls upon DialogSystem::onCancel() which calls doClose() of either DialogSystem or your own override through subclassing. The default doClose() function executes CEGUI::WindowManager::getSingleton().getWindow(m_window)->setVisible(false), which hides the dialog. Make sure that setVisible(false) is properly called within a doClose().
Your MagWorldApp::handleEdit() function is initializing/creating many Cegui items. These would need to be undone when you "close" the dialog, otherwise you'll have problems when you call upon handleEdit once again. Either you pre-load those or use a state variable to bypass all the code and only call upon editDialog.doOpen() the second time you start the editor.
Also try to compile the sample as is; the behavior you are seeking should be functional within that demo. If not then there's a problem with your Cegui source code.