handle close bracket + fix close brace handling