Dimensional crossover and the freezing transition in density functional theory