Add descriptive error message for closure use in invariant check functions