title: Program exits before done - concurrency issue in for loop - goroutine not working
body: <p><strong>My Go project breaks when I try to write concurrently.</strong></p>
  
  <p>I have a map <code>map[string][]strings</code>. I want to write files concurrently, which are named as <code>key + ".csv"</code> and for each value of <code>[]strings</code> write another row to the file with the value in it.</p>
  
  <p><strong>What I've done:</strong></p>
  
  <pre><code>for key, val := range varValMap {
          go writeCsv(key, val)
      }
  </code></pre>
  
  <p><strong>And the func is:</strong></p>
  
  <pre><code>func writeCsv(variable string, values []string) {
      fName := variable + ".csv"
      fPath := filepath.Join(xmlFolder, "_varval", fName)
      file, err := os.Create(fPath)
      check(err)
      defer file.Close()
      for _, value := range values {
          fmt.Fprintf(file, value + "\n")
      }
  }
  </code></pre>
  
  <p>The program finishes with no problems detectable by me, yet with no complete result (some files are written but nothing in them), also when I remove <code>go</code> from <code>go writeCsv(key, val)</code> all is well in go land.</p>