Reversible photomagnetism in a cobalt layered compound coupled with photochromic diarylethene