Now working with applications such as vim.

Should (mostly!) address issue #5.
Some issues remain - still get
	tabula: <file descriptor: 4>: hPutBuf: illegal operation (handle is closed)
in apps that take over the whole screen. Suspect this is a race thing,
reordering should hopefully fix it.
Don't close the handles on the pty.

Now worried that I'm leaking ptys, but what ho.