Fix a race when initializing libhelium and fix scanf usage in shell

We were starting a thread with uv_loop_run with a loop with no handlers
on it, this caused a race where the thread could exit before
helium_alloc had run, thus making all the other helium functions block
waiting on a thread that was already dead. The fix is to start the
thread once we've set up all the loop handles in helium_open.

This also fixes some bugs with scanf. We weren't chomping the newline
from stdin on a successful match, nor were we checking that exactly the
right number of inputs was being matched. Both of these have been fixed.