Withwhen, use the past perfect to make it clear that one thing finished before another started.
When I had written my letters, I did some gardening. (NOT When I wrote my letters, I did some gardening.) When hehad cleanedthe windows, he stopped for a cup of tea. (NOT When he cleaned the windows, he stopped for a cup of tea.)
We don’t often usewouldin subordinate clauses; instead, we use past tenses.
Would you follow me wherever I went? (NOT Would you follow me wherever I would go?) I would tell you if I knew. (NOT I would tell you if I would know.)