Updated matinpublish to avoid writing over existing files