We're not sure of the exact steps for creating this error, but If you have Windows Server 2012 R2 and are using IIS to export/import certificates around, you might eventually see then when trying to use the certificate:

A specified logon session does not exist. It may already have been terminated. (Exception from HRESULT: 0x80070520)

Our workaround for this issue is to use the traditional mmc.exe for export/import. Steps to use the MMC GUI rather than IIS:

  1. Click Start, and then click Run.
  2. Type MMC.EXE and click OK.
  3. Click Console in the new MMC you created, and then click Add/Remove Snap-in.
  4. In the new window, click Add.
  5. Highlight the Certificates snap-in, and then click Add.
  6. Choose the Computer option and click Next.
  7. Select Local Computer on the next screen, and then click OK.
  8. Click Close, and then click OK.
  9. You have now added the Certificates snap-in, which will allow you to work with any certificates in your computer's certificate store. You may want to save this MMC for later use.