Completed process Stream function to emit end properly