Properly call dev.off().

Previously there was a trailing single quote on the call
to dev.off() which I am unsure of the effect of, either
it somehow shut up the output of this function, or maybe
it just kept the call from working at all.

Instead just put the return value of dev.off() which is
the previous graphics device into a variable instead of
allowing it to go to the screen.