The correct option is B when
We use "when" as subordinating conjunction to introduce adverbial clauses of time. It means during the time that and indicates that something is or was happening when something else occurred: the speaker was walking down the street when the crash occurred. Hence, Option B is correct. The rest of the options do not adhere to this rule, hence they're incorrect.