Split/merge dialog: destroy 3D viewer when closed without "cancel" button

The 3D viewer wasn't destroyed when one closed the dialog with the help of the
little X in the upper right corner. This broke the 3D viewer and made it not
appear on subsequent dialogs. This commit fixes this by using a proper close
method like suggested by the jQuery UI API documentation. In there the whole
dialog is destroyed, including the 3D viewer. This is related to issue #605.