Magnetic thin films of cobalt nanocrystals encapsulated in graphite-like carbon