Wait for subprocess commands to complete