diff --git a/pkg/machine/apple/vfkit/helper.go b/pkg/machine/apple/vfkit/helper.go index 47a3c98bf6..43a40d6352 100644 --- a/pkg/machine/apple/vfkit/helper.go +++ b/pkg/machine/apple/vfkit/helper.go @@ -83,8 +83,10 @@ func (vf *Helper) stateChange(newState rest.StateChange) error { } payload := bytes.NewReader(b) serverResponse, err := vf.post(vf.Endpoint+state, payload) - _ = serverResponse.Body.Close() - return err + if err != nil { + return err + } + return serverResponse.Body.Close() } func (vf *Helper) Stop(force, wait bool) error {