Close context menu before destroying panel