wip

writer should be flushed after moving out of scope