Waits for duration, stopping early when the run is stopped.
duration
Future<void> wait(Duration duration) => _sleep(duration);