With VC2012 the code crashes.
I've got the message "Runtim Error! Program: ... R6025 - pure virtual function call"

The reason is that the stream's destructor accesses the facet again witch has...