repl: should not capture aborted statements

The memory for the REPL was "saved" even in the case of a
bufferedCommand.  This causes .save to save aborted multi-line
statements e.g.

>var top = function() {
>.. var something = 1;
>.. CTRL-C

This is a problem in two cases.
1. The REPL will save these lines and write them out during
   the `.save` function
2. The REPL will remember these lines and potentially inject
   nonexistent variables into other local tab completions.

The basic fix is to move the `memory` call from the top of
`finish` to below the bufferedCommand check.

The fallout was to remove the side effects from the `memory`
function.  So it could be used in the `complete` function to
append the `bufferedCommand`.

I also updated the nested "magic" REPL to pass the useGlobal:false
param instead of injecting my own context.