Arduino Pro Mini interrupts timer not working
In untested (pseudo-)code

unsigned long lastSerialInput = millis();


void loop()
{

    if(!myFile)
        myFile = SD.open(filename, FILE_WRITE);


    while(Serial.available())
    {
        incomingByte = Serial.read();
        myFile.println(incomingByte,HEX);

        lastSerialInput = millis();
    }

    // check for 25 seconds of inactivity
    if( myFile &amp;&amp; (millis()-lastSerialInput &gt; 25000 )
    {
        myFile.close();
        fileNo++;
        filename = "datalog";
        filename += fileNo;
        filename += ".txt";

        //save new fileNo to config.txt (though I'd personally find the file with the largest number in setup instead of relying on a config.txt file)
    }

}