Data dir creation is moved to before server shutdown since it is needed before then.