This isn't a bug, this is well documented. The closing brace is only emitted to the stream when the archive is destructed. In your first example, you do this correctly. In the 2nd example, you are getting the string out of the stream on line 27, but the destructor isn't called until 31.
Line 33 doesn't print it of course, since you are just re-using a copy of the same string, as captured on line 27.