extra: use static mut to wrap linenoise calls in a mutex.

Fixes #3921.
extra: stop rl from leaking each line that is read.