[Minor] fixed compiler warnings about calling close() on stream