Fix a flaky test by draining the worker pool after syncing.

Closes #2048