Only print foreach close brace once.  Closes #377