Safer closing of the error window.