Fix some end tags in erb template, fixes #1754