That's the top wall plate. You can simply cut it flush with the stud faces and fill in the drywall, adding floating backing where needed. I'd use a reciprocating saw, but a small hand saw will work. You could also drill a series of holes against the stud to cut the plate off, then use a sharp chisel to trim off any protruding wood. A 1/2" or 3/4" spade bit would work well. 

Interior walls (except in basements) usually have doubled top plates, but this closet may have been added later. It looks like there's just the one.

I suggest a little study into basic framing techniques before you proceed. Hopefully you haven't removed a bearing header. 

[![enter image description here][1]][1]

<sub>[image source](https://www.carpentry-pro-framer.com/wall_framing.html)</sub>

  [1]: https://i.sstatic.net/jPaXT.png