Attach (recommended) or Link to PDF file here: [ACORD 0211 2016-09 Acroform BLANK.pdf](https://github.com/mozilla/pdf.js/files/6353664/ACORD.0211.2016-09.Acroform.BLANK.pdf)

Configuration:
- Web browser and its version: Google Chrome Version 90.0.4430.72 (Official Build) (x86_64)
- Operating system and its version: Windows 10 Pro 20H2
- PDF.js version: 2.7.570
- Is a browser extension: No

Steps to reproduce the problem:
1. Load attached form into PDFViewer
2. Call saveDocument method on loaded document proxy

What is the expected behavior: should not crash

What went wrong? (add screenshot)
It crashes in writer.js. Line 273 as of 21 Apr 2021.
![image](https://user-images.githubusercontent.com/10527821/115615989-4d747900-a2f8-11eb-8e6a-fa3070d813a7.png)

Line that crashes: 
![image](https://user-images.githubusercontent.com/10527821/115616056-6846ed80-a2f8-11eb-8df1-b4633d3e5e8e.png)

Potential fix: 
![image](https://user-images.githubusercontent.com/10527821/115616270-af34e300-a2f8-11eb-82c9-c13bfd111fe4.png)

Potential fix is based on this line if worker.js file: 
![image](https://user-images.githubusercontent.com/10527821/115616437-e0151800-a2f8-11eb-947c-d89e72774bd5.png)


Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): not hosted

}
  if (xrefInfo.encrypt !== null) {
    newXref.set("Encrypt", xrefInfo.encrypt);
  }
  
  newRefs.push({ ref: refForXrefTable, data: "" });
  newRefs = newRefs.sort((a, b) => {
    
    return a.ref.num - b.ref.num;
  });
  const xrefTableData = [[0, 1, 0xffff]];
  const indexes = [0, 1];
  let maxOffset = 0;
  for (const { ref, data } of newRefs) {
    maxOffset = Math.max(maxOffset, baseOffset);
    xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
    baseOffset += data.length;
    indexes.push(ref.num);
    indexes.push(1);
    buffer.push(data);
  }
  newXref.set("Index", indexes);
  if (xrefInfo.fileIds.length !== 0) {
    const md5 = computeMD5(baseOffset, xrefInfo);
    newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  }
  const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  const sizes = [1, offsetSize, 2];
  const structSize = sizes[0] + sizes[1] + sizes[2];
  const tableLength = structSize * xrefTableData.length;