save file in goroutine