It wouldn't, but the CLI commands expect the device to be in Listening Mode to work.
And your wire.endTransmission()
issue may well cause the device to be unable entering LM via the button due to some blocking behaviour.
It shouldn't prevent Safe Mode tho'