ensure task state gets reset in wait() in exception cases

I believe this can only happen on an InterruptException, but might as
well make sure any running task is not in the :waiting state.
rename read to read! where a passed array is modified. fixes #5970