How can I recover from an SD card I/O error?

I am using the SD library for writing data to a file on the SD card of an Adafruit Data Logger shield. I write to the file at certain times of the hour and I call the flush() routine after data is written. So far so good.

From time to time (once a day, or once every few days) I want to remove the card so that I can copy the data to my laptop and then reinsert it. I know when the Arduino is writing to the file. I avoid these times and remove the card only when the Arduino is not writing to the file. However, the Arduino receives a error on the next write to the file after the card is reinserted.

I do not want to close the file after each write. Restarting the app is the only recovery method that I have found so far that works. I have found that all of the following DO NOT recover.

write to file
if (write failed)
close file
re-open (this works)
write to file - (this always fails)

write to file
if (write failed)
close file
call sd. begin - (this always fails)

How can I recover from this error in software without a system restart?

cdj15:
I do not want to close the file after each write.

Why?