Merge #11783: Fix shutdown in case of errors during initialization