Stop waiting for resources in ERROR state

As soon as a resource changes to the ERROR state, stop waiting for
it.  Return it to the caller, where it will be deleted.

Change-Id: I128bc4344b238b96e5696cce87f608fb2cdffa6e
Merge "Stop waiting for resources in ERROR state"