Complete the writeState().