made CountDownLatch safe wrt spurious wake ups