close buffer