Since the class needs to be copy-constructible, there may be many copies of an instance. So instead of writing to the device on every destructor call, only flush buffer on the last destructor call.