Fail early if we can't get the closest site

fixes a `Trying to get property of non-object` error