If you wanted to use while or when, you would have to delete the comma; otherwise it's not possible to use either of the two and convey a similar meaning.
Someone might, however, say that you could use while meaning whereas, to introduce the contrast between two situations:
I walked into the garden, whereas Tom and Jim were tying...
But to me, there is no parallelism between the two tenses used, and therefore the two sentences don't match.
That's why the best answer is where.
Student or Learner