Fix some process management issues

There were two main problems observed.

    1) If using a post process script/program you could end up with more
       encode processes than NR_WORKERS. This problem was introduced by
       commit b141fed ("Add the ability to run a program after each file
       encoding"). The issue is that when the external program exits
       encode_vobs will receive a SIGCHLD which will end up with another
       encode process being run regardless.

    2) Sometimes do_processed() would not get run which would mean no
       "Finished" message and no post encode process being run. This
       problem was likely always there it was just much more likely to
       be hit when running post processes due to some signal handling
       race condition.

Fix these issues by re-working the main process loop greatly simplifying
it in the process. The race condition in no 2 may still be there but it
is greatly reduced and I haven't been able to hit the problem with this
commit but it is 100% reproducible without.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>