make closeRow work recursively and add doctests