Cleanup of stdin handle
Fixed not being able to quit

When gotty was waiting for a device to appear it was impossible to quit
using the ctrl-g ctrl-q sequence. This is now fixed.