Fixed streams not being destructed properly.