Reimplement waitgroup using chan instead of runtime.semaquire