Make directories before writing file.
ProgressListener is now a simple interface delegating the actions to implementors.