Added throws IOException declaration to writeTo.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>