Sd card stops working after a day of use.

Looks like there there are paths through the code where cardFile is opened but never closed. This will cause a memory leak and SD operations will fail.

SD.h has a nasty property of allocating memory with malloc() when a file is opened and releasing the memory on close. This often causes memory leaks.