Arduino can't write MPU6050 data to SD card
You seem to be expecting a statement of the form

idx ;


to increment a variable, but it will not, so your idx and count variables are forever 0 and you keep trying to re-open the same file without ever closing it.

To increment a variable, use the ++ operator as in

idx++;

count++;