I spoke too soon. This does not work. As long as i don't call
while (Serial.available())
gps.encode(Serial.read());
The program works fine, when i include these lines, the program continuously reboots itself. I guess i have to look into a standalone SD Card writer, unless someone has an alternative.