This adds the ability to wait with a timeout for CheckApply happenings in a resource. This helps avoid unnecessary long sleeping and timing guesses. This also adds a cleanup function to run at the end.