Confinement effects on freezing and melting