use tempfile for capture

Change-Id: I2d7b00f6cf26a338c19953936389eb0bec235a67