Fix to prevent batch gen error

Lorcan reported an error if 'remove layers on batch generation' box
checked and generate image button used.