Serial Monitor and sd card values are not the same

It opens for 5.75 sec and then stays open!

I don't understand that statement.

Does it open for 5.75 seconds in the initial sequence, and then close? Do you see the serial print "OFF 0"?
Then when it reopens again it does not close after interval = 500ms.

What else do your serial prints tell you?

You've been through this before. You should add more serial prints to your code until you can see all the states and logical conditions to understand why you don't enter a conditional statement.