Separates the masks into multiple files