Field-free alignment in linear molecules by a square laser pulse