[WIP] Fixes to job and channel modules

Fix some bugs in the channel/job modules(Some might have noticed that the embedded nvim instance doesn't quit after running make test, that was a channel.c bug)