Non-unitary evolution of neutrinos in matter and the leptonic unitarity test