Fix missing closing foreach