LPS-31269 We need to set the closeRedirect also when there are errors (and moving logic to a more generic place to reuse it)