Added closeLoop()

Added a function which closes a level of loop. Basically shorthand for
decreasing the indent level and adding a square bracket.
Has a parameter called "depth" (defaulted to 1) which specifies how many
square brackets there are i.e. how deep the loop (or, indeed, loops) you
want to close is (or, indeed, are).