Added error message when loop is not closed for ]