Added 'marker-quit' function, and gracefull stream close incase of multiple streams are present.
If marker-quit is enbled, the program will terminate after receiving a terminate marker. It will terminate when all streams have
reported the terminate marker, or a timeout equivalent of the same number of streams has passed.
It does not handle start-terminate-start before the termination has complete, in this case behavior is unknown/undefined.
Cleaned up formatting.