Fix rmagic for cells ending in comment.
Fix rmagic for cells ending in comment.

Closes gh-5579

Simplest possible fix, because rmagic is being moved out to rpy2. But
it's not released there yet, so it's still worth fixing this.

ipython/ipython,ipython/ipython