integration-cli: check nil before Close'ing Upstream-commit: ba15b6f04936b3e38fb5b832e28ceb02277fc2e5 Component: engine