make sure stream is not disposed by streamwriter; closes 163