Rahul2689“Do relative pronouns follow the nearest antecedent ???”
You are speaking as if there were several antecedents, and one of them is nearest the relative pronoun, where in fact there is always only one. You are confusing "noun" with "antecedent". There may be several nouns which are candidates for being antecedents, but there is only one antecedent.
And the antecedent need not be the noun nearest to the relative pronoun. The relative pronoun probably follows its antecedent directly 98% of the time, but it does not have to. As in the example above, the verb form within the relative clause may help to locate the antecedent, but in other cases you have to resort to common sense.
Also, in the case of a final which clause preceded by a comma, there might not be any single noun that serves as an antecedent. The clause then refers to the whole idea expressed earlier in the sentence.
CJ