[BUGFIX] Restore registers before early returns

Having an empty image list or a list of images with empty values
will not restore the loaded registers.
So we must restore the registers before any return.

Additionally, the $conf array does not need to contain any
values when calling RESTORE_REGISTER, since it won't handle
parameters anyway, so parameters would just waste memory.

Resolves: #56796
Releases: 6.2
Change-Id: I3e81c614b5c37a14da4b97e18a310e202ae7b766
Reviewed-on: https://review.typo3.org/28280
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Jo Hasenau
Tested-by: Jo Hasenau
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel