It's not the width, it's the diameter. 235/40/18s are quite a bit bigger in diameter than 245/40/17s. The tires you ordered are almost an inch taller than the OEM tires, so they will be 1/2" closer to rubbing than the OEM set up. On full compression of the suspension, it may rub. It also might not, but that's a big difference. Hope for the best.
Also, your speedo may be off. You will be going 3% faster than your speedo indicates if it was accurate from the factory. If it started 3% slow as many do, you'll be OK for indication.