Wait for flac conversion until it ends reagardless of run_level. Wait for spawned mktorrent processes. As a result script exits only after all jobs are done.

Use process substitution instead of pipes as wait builtin won't wait for processes spawned by a subshell. Get rid of unreliable pgrep + sleep loop.