Modifying the wait logic for newly created images to avoid tracebacks

Fixes #4619