Automatically reset cursors after dtor

This follows the RAII pattern in C++