Ensure restoreOverrideCursor is called even if there is a TypeError