Change IllegalArgumentException to IOException so it is checked.

At @myleshorton's request.