The Wi-Fi drops or the MacBook wakes from sleep, and the SSH session in your terminal just sits there. Ctrl-C does nothing, because the keys go into a connection that’s already dead. You don’t have to close the tab. The ssh client has its own escape keys, and it listens to them locally.
Enter ~ .
Press Enter, then a tilde, then a dot. The ssh client reads that itself and disconnects at once, whatever the other end is doing. The Enter matters, because ssh only treats ~ as the escape character at the start of a line.
There are more of them. ~? lists them all, ~# shows the forwarded connections and ~^Z (tilde, then Ctrl-Z) puts ssh in the background. ~C opens a small command line where you can add a -L, -R or -D forward to a session that’s already running, but recent OpenSSH versions switch that one off unless you set EnableEscapeCommandline yes in your ssh config.
Nested sessions need one extra key. Say you ssh into a jump box and from there into another server. ~. is caught by the first ssh client, on your laptop, so it closes the whole chain. Type the tilde twice to pass one through to the inner session:
Enter ~ ~ .
That closes only the inner connection and drops you back on the jump box.
The catch is that escapes only work in a session with a terminal (a pty). When you run ssh host somecommand or pipe data through ssh, there’s no escape to type. If the tilde ever gets in your way, change it with -e or the EscapeChar setting, or turn escapes off completely with -e none.
Further reading: ssh(1) manual: escape characters, ssh_config(5) manual