Fix race condition when waiting for a concurrent layer pull Upstream-commit: c044dadadea5b13bb0216321c79f51c4f8d44c09 Component: engine