ACK Polling to detect end of Write Cycle for 24C512 EEPROM:R-W/=0 does not work!

Try to print TWSR via Serial.print when it is in the infinite loop. For example you may read the register and print it each time it changes. I guess you have some typo in your code.