Fix BufferedWriter triggering std::terminate on exception when writing
Fix BufferedWriter triggering std::terminate on exception when writing

Fixes #2932

alexherbo2/kakoune,danr/kakoune,mawww/kakoune,casimir/kakoune,jkonecny12/kakoune,Somasis/kakoune,casimir/kakoune,occivink/kakoune,casimir/kakoune,danr/kakoune,alexherbo2/kakoune,alexherbo2/kakoune,Somasis/kakoune,mawww/kakoune,danr/kakoune,occivink/kakoune,occivink/kakoune,lenormf/kakoune,Somasis/kakoune,mawww/kakoune,danr/kakoune,jkonecny12/kakoune,mawww/kakoune,lenormf/kakoune,jkonecny12/kakoune,casimir/kakoune,lenormf/kakoune,alexherbo2/kakoune,Somasis/kakoune,occivink/kakoune,jkonecny12/kakoune,lenormf/kakoune