Raise a better exception

Simplify re_record_interval processing
Don't leave files open