remove MagickWand and hide window before printing error message