I have found the problem! I explain:
I was doing tests to see what would happen if the program tried to work without an SD card. As you can not initialize it since it is not there, trying to create a directory with 'mkdir' causes a serious error (I do not know exactly what it is) that crashes the program and causes it to run again from the beginning!
Regards!
PS: I was going crazy! XD