Fix exception handling in ProcessManager.main