Always pass -batch when --headless is given

The previous logic only appended -batch under certain conditions. The
intended use case was when passing .ijm files as the first argument, but
the check was rather fragile. Really, we should just always pass -batch
in the case of --headless when the main class is ij.ImageJ or fiji.Main.

However, note that normally, the -batch flag requires a follow-on
argument specifying the macro or script to execute. Only when the -batch
flag is the final argument to ImageJ does it relent and disable the GUI
without requiring a corresponding macro or script file to run. So we
must take care to ensure that -batch is only appended as the final
argument, and only if -batch does not also appear elsewhere already.

With this change, the following invocation now works:

    ./ImageJ-linux64 --headless -eval "print ('Hello World');"