Electronic and optical properties of nitrogen-doped multiwalled carbon nanotubes