BUG: needed writer->Update() instead of writer->Write()