always close file on exception; restart on more exceptions