Unbind buffer before calling functions that can throw