[releng] PR #8412: Fix the script to handle other exceptions, retry only when AMIs don't exist