Properly release resources after HTTP errors.