Closing the streams

I added the close for the streams, have a look!