Separate IO to a different thread

@oxmane Please CR
At least on IntelliJ this generates a warning (unchecked assignment from Set to Set<Map.Entry>, we can consider being a saint and enumerate over the set as Objects and check that each one is really an Entry).