Rack::Logger naked rescue fix

This is similar to #11497.

PS: there are no other dangerous "naked" `rescue`s in the rest of the Rails codebase.