use tempfile for capture

Change-Id: Idae00f1e9832541d615f148851d4b4294fb5b5eb