Reorganise the requestAnimationFrame loop to handle errors correctly

Since 413dac94b396b6b55da94ace6cd8efd9b43c1d12 errors are no longer
caught by default, which is a good thing for exposing user errors.
However, the current structure of the main fastdom loop means that a
single user error will mean that the loop will never be run again, so
jobs will continue to be added to the framelist but never processed.

This reworks the main loop to handle fastdom tasks first, ensuring a
consistent and robust state, and then running the user code where it
can error safely.