If you really don't care about waiting for the stream, you can really close the handle immediately after creating the stream.
However, I categorically do not recommend this. You should always wait until the threads are removed (preferably in a clear, well-defined way). If this has not been done before, wait for each thread that you spawned when the program exits. Always, no exceptions.
Do not leave main without knowing if other threads continue to run. If necessary, kill them in a difficult way (although it is desirable, let them be gracefully controlled and wait for him).
If you do not wait for the threads to finish, you may see strange exit failure conditions. Or, even worse, you may not see them, and only users / clients complain that once a hundred times the configuration file is damaged (or, even worse, the data file) 1 . Now imagine that they can demonstrate step by step what they are doing, and you can say that they are doing everything right, and there is no way for something to go wrong. Good luck with the fact that the accident is caused by the fact that the workflow is working on some object (or global state) that was simply removed from the main main thread, explicitly or implicitly using a CRT.
Of course, your position may be that the workflow will exit long before the program ends anyway, so why bother. However, it plays Russian roulette.
1 This is not fiction, but something that I really saw before.
Damon source share