close stream after calculating resource version