writes weights out