[io] Check whether a form still exists before resetting it

IO clears the form content on end, but if the caller removed the form soon
after it was called, this fails at a removeAttribute on part of the, now
non-existent form content.

We should check that the form exists before attempting to reset it.
IO: Build.