Fix trailing whitespace trimming

Apply the trailing whitespace setting to all buffers it is relevant to,
not just the last opened one.