Fix buffer closing

0cbf5fc4 uncovered an old bug
Thanks for noticing, @torhve
Merge pull request #295 from glowing-bear/fixbufferclosing

Fix buffer closing