Fixed server crashing from calling Close() early.

It was calling res.Body.Close() before the program checked for errors,
which resulted in a nil pointer reference.