fix race in Future::waitWithSemaphore