### ImageMagick version

7.1.1-12

### Operating system

Linux

### Operating system, version and so on

Ubuntu 22.04, ImageMagick compiled from source

### Description

Some, but not all, JPG files are now outputting three files instead of one, with suffixes of -0 -1 and -2. I'm only using the `-auto-orient` and `-thumbnail` flags, but it does it for both.

If I index my input file to 0, e.g. `sample_file.jpg[0]` instead of `sample_file.jpg`, it outputs just a single file like previous versions.

Also tested on macOS using 7.1.1-12 via homebrew, same problem.

### Steps to Reproduce

7.1.1-11 and earlier:

```
$ convert -auto-orient sample_file.jpg rotated.jpg
$ ls
rotated.jpg sample_file.jpg
```

7.1.1-12:

```
$ convert -auto-orient sample_file.jpg rotated.jpg
$ ls
rotated-0.jpg  rotated-1.jpg  rotated-2.jpg  sample_file.jpg
```

If I explicitly index to 0, it does what 7.1.1-11 did:

```
$ convert -auto-orient "sample_file.jpg[0]" rotated.jpg
$ ls
rotated.jpg sample_file.jpg
```

### Images

![sample_file](https://github.com/ImageMagick/ImageMagick/assets/8009/1fa881a3-e310-4d1b-a5a4-0537dc18471c)

Converting some JPG files results in multiple output files
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Converting some JPG files results in multiple output files
Issue date:

--- start body ---
### ImageMagick version

7.1.1-12

### Operating system

Linux

### Operating system, version and so on

Ubuntu 22.04, ImageMagick compiled from source

### Description

Some, but not all, JPG files are now outputting three files instead of one, with suffixes of -0 -1 and -2. I'm only using the `-auto-orient` and `-thumbnail` flags, but it does it for both.

If I index my input file to 0, e.g. `sample_file.jpg[0]` instead of `sample_file.jpg`, it outputs just a single file like previous versions.

Also tested on macOS using 7.1.1-12 via homebrew, same problem.

### Steps to Reproduce

7.1.1-11 and earlier:

```
$ convert -auto-orient sample_file.jpg rotated.jpg
$ ls
rotated.jpg sample_file.jpg
```

7.1.1-12:

```
$ convert -auto-orient sample_file.jpg rotated.jpg
$ ls
rotated-0.jpg  rotated-1.jpg  rotated-2.jpg  sample_file.jpg
```

If I explicitly index to 0, it does what 7.1.1-11 did:

```
$ convert -auto-orient "sample_file.jpg[0]" rotated.jpg
$ ls
rotated.jpg sample_file.jpg
```

### Images

![sample_file](https://github.com/ImageMagick/ImageMagick/assets/8009/1fa881a3-e310-4d1b-a5a4-0537dc18471c)

--- end body ---
