change write_int32 to take an array of int32s
fix termination error when file length is exact multiple of FILE_READSIZE