cmd/api: fix race in run.go with multiple builders on a machine

Fixes #9407

Change-Id: I765e8009c7ee22473ac8c2d81c7f6c8ec9866c51
Reviewed-on: https://go-review.googlesource.com/1980
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>