Fix synchronization in building BioSpec layers

Make sure that other threads waiting for build() to complete wait on the
correct condition.  As soon as one layer is added, the test
"getNumLayers() == 0" fails and other threads would proceed.