Use pathlib for handling file manipulations

Just playing around with `pathlib` for now.

Makes some things much nicer like default open encoding, makes some things more annoying... see diff