Wait for current device scan to finish before starting next one

@kentquirk You had pointed this bug out to me. Want to take a look at this? I just modified the `repeat` function to take an asynchronous function as an argument. Thanks!