handle buffers opening/closing