NiO nanocrystals encapsulated into a nitrogen-doped porous carbon matrix as highly stable Li-ion battery anodes