Physically disconnecting the microphone when a laptop's lid is closed is a good step towards better security, but it doesn't remove the risk of eavesdropping when the laptop's lid is open when it's being used, or even when it's gone to sleep with the lid open.
The cameras on the latest MacBook Air and MacBook Pros aren't disconnected, however, as the 'field of view is completely obstructed when the lid is closed,' Apple says in its T2 security chip documentation. With a physical disconnection, software-based attacks like the FruitFly malware can't enable the microphone.
It's Apple's 'T2' security chip that the company includes in its latest lineup of MacBook Air and MacBook Pros that physically disconnects the microphones when the lid is closed. Apple's latest MacBook Air and 2018 MacBook Pros physically disconnect their own microphones when you close the lid, preventing eavesdropping hackers from listening in to conversations when you think the computer is in sleep mode with the lid closed.