Use window functions in iter_bounds

This is an adaption of
https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/WindowedRangeQuery
Check the solr core versions on startup
Remove dead code
Add a context manager for sessions
Let db_session and solr_connection access the config
Raise an exception if the config file can't be read