[BUGFIX] Clean up category references when a file is deleted