Check for error before deferring to close resource
Check for error before deferring to close resource

In case of error, returned resource is always nil.
Deference it only when call was successful

Closes #113

cloudflare/goflow,cloudflare/goflow