Adding an option to specify, whether to wait for all Futures to complete inside withLock.