finish write and read