What did I do and how do I stop it from ever happening again?

See also PSA: Script to back up and restore Plex app data on a Windows system because for a successful backup you need to stop Plex server. Otherwise your backed up database will be defective.