Improve closing buffers