Credo che il main debba attendere che i thread siano terminati; usa la WaitForSingleObject a questo scopo.