Add cwindow to close if any error is not detected