Wait for stdin end when livesyncing with enabled watcher

This enables us to close the node process from a parent process using the stdin pipe.
Its end event will be fired when we close the pipe manually or close the parent process.
Refactoring after code review
Merge pull request #176 from Icenium/paletov/wait-for-stdin-end-on-long-commands

Wait for stdin end when livesyncing with enabled watcher