Remove the remaining raw pointers

Fixes #195
I think that the if stream already calls close() in it's destructor, can you check?