Removed Popen.wait() calls that were not needed and could deadlock.
Also added a few try-finally pairs to release resources on exceptions
Corrected use of try-finally for semaphores; more try-finally use.
Manifest checking code was suspect for generating errno 11 on large
restart. Hardened resource release on this one.