Improve loop cleanup facilities

Extract loop_delete logic into loop_exit and expose it as a method that can be
called by the user.
Bump version