cope with badly closed files