Fix bug in REPL where history file was closed late.

The history file was set to close on process exit, when it
should close on REPL exit. Listening to the process exit
event causes a warning when more than 10 CoffeeScript REPL
instances are opened in the same program, which happens in
the test.
Merge pull request #2943 from bobbydavid/master

fix warning in REPL tests about memory leak.