How do you stayed focused on a task when the task involves some type of waiting?

For example, I have a really hard time staying focused at work. The problem for me is, our software can be really really really slow. While I’m waiting for Outlook to load an email, or our internal tooling to populate data, I find my mind is wandering. Often, I’ll start on another task or pick up my phone and just completely forget about the first thing I started.

At the end of the day, I have to figure out why I have 8 half written emails open in the background of my PC.

How do you stay on track when your tasks require patience?