use os.makedirs()

Fixes issue of missing intermediary dirs.