wal: save latest state into new WAL

fixes #1826