block: Fix dio_cleanup() to advance the head index