Testing nonunitarity of neutrino mixing matrices at neutrino factories