python subprocess wait for completion