prevent task switches from finalizers during gc, and print error messages generated in finalizers