Adding logic to correctly clean up buffers pushed to the buffer queue when stoping the element