Adding that closing php tag as instructed broke my website.
Not likely. That behavior is indicative of some other issue, the most common being white space after the closing PHP tag. Another issue might be improperly written functions in
functions.php, that are returning output improperly (though likely you'll still get the "headers already sent" error, just at a later point in the process).
So the Codex is just plain wrong when it says to add a closing php tag.
It's not wrong, it's just not an exclusive or exhaustive answer. As @esmi pointed out, there is nothing wrong with omitting the closing PHP tag in
functions.php. Either adding it or omitting it is equally valid with respect to proper PHP syntax. Mainly, the difference is that omitting the closing PHP tag might be a bit more error-proof.
How can we trust using the Codex when it give such bad instructions that break the site?
The instructions aren't bad; they just may not be as complete or thorough as they could be. That said: anyone with valid wordpress.org login credentials can edit the Codex.