Handle truncated files gracefully