i could just delete the line for closing the file and it should be work
No. You still read all the data in setup(), so there is nothing left to read in loop(). Why are you doing that?
Why not toggle the LED in setup() if you are going to read the file there?