Always close mgo.Iter after use

The documentation for mgo.Itr says that the iterator should be closed after use. Reading the source the difference between Iter.Close() and Iter.Err() is the latter doesn't close the iterator (cursor), but both will return any error that occured so are interchangable in this respect.

Replace all the calls to Iter.Err() with Iter.Close, do some general cleanups and replace fmt.Errorf with errors.Errorf in affected functions.
Merge pull request #135 from davecheney/close-mongo-iterators

Always close mgo.Iter after use

The documentation for mgo.Itr says that the iterator should be closed after use. Reading the source the difference between Iter.Close() and Iter.Err() is the latter doesn't close the iterator (cursor), but both will return any error that occured so are interchangable in this respect.

Replace all the calls to Iter.Err() with Iter.Close, do some general cleanups and replace fmt.Errorf with errors.Errorf in affected functions.