Added close and ingest on shutdown