Fixed race conditions in sync and async batch cursor tests