Fix bug in import

I'm not 100% sure what happens, but I think I missed flushing the
session properly. Now I commit every 10000 entries.