mainTemplate parameter always required. Streams closed where opened.