Fixed closing buffer behavior