close modal after error message