Bugfixes and creating of dir if not existing when creating file per namedLayer