[cipd] Move resp.Body.Close() to after err check

If the err value is non-nil we can safely ignore the resp.Body per
https://golang.org/pkg/net/http/#Client.Do

```
On error, any Response can be ignored. A non-nil Response with a non-nil error only occurs when CheckRedirect fails, and even then the returned Response.Body is already closed.
```

Change-Id: I9aa3d16bc1a379ad0cf6cb0977a62e6b479059ec
Reviewed-on: https://fuchsia-review.googlesource.com/c/jiri/+/528184
Fuchsia-Auto-Submit: Nathan Mulcahey <nmulcahey@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Ian Kasprzak <iankaz@google.com>
Reviewed-by: Haowei Wu <haowei@google.com>
diff --git a/cipd/cipd.go b/cipd/cipd.go
index d95765a..f4392db 100644
--- a/cipd/cipd.go
+++ b/cipd/cipd.go
@@ -276,10 +276,10 @@
 	var contents []byte
 	if err := retry.Function(jirix, func() error {
 		resp, err := client.Do(req)
-		defer resp.Body.Close()
 		if err != nil {
 			return err
 		}
+		defer resp.Body.Close()
 		if resp.StatusCode >= 400 {
 			return fmt.Errorf("got non-success response: %s", resp.Status)
 		}