Hi everyone, my teacher told me sentence one and two are correct and mean the same but that three is not correct and four is correct.

Can anyone tell me why 3 is not correct?

1. By the time James retires I will be fifty-nine.
2. When James retires, I will be fifty-nine.

3. By the time I leave here, I will do a demonstration in the office.
4. When I leave here, I will do a demonstration in the office.

Thanks!