Fix bug with switching to core buffer when buffer is closed