Only close response object if it exists.