added periodic stream-cleaning, in case streams dont get closed properly