Created a queue system to make sure the streams are always closed