fix for closing buffers