throw error if there is no ending tag