Properly handle serial close on Macs
Properly handle serial close on Macs

Readline could still be stuck in a read loop, leading to an exception on Mac
when closing the connection from another thread. This should now be captured
correctly.

Fixes #1021

MoonshineSG/OctoPrint,chriskoz/OctoPrint,javivi001/OctoPrint,Jaesin/OctoPrint,bicephale/OctoPrint,chriskoz/OctoPrint,Jaesin/OctoPrint,javivi001/OctoPrint,beeverycreative/BEEweb,foosel/OctoPrint,shohei/Octoprint,JackGavin13/octoprint-test-not-finished,Salandora/OctoPrint,Salandora/OctoPrint,Jaesin/OctoPrint,chriskoz/OctoPrint,Salandora/OctoPrint,bicephale/OctoPrint,Jaesin/OctoPrint,JackGavin13/octoprint-test-not-finished,senttech/OctoPrint,javivi001/OctoPrint,shohei/Octoprint,foosel/OctoPrint,beeverycreative/BEEweb,MoonshineSG/OctoPrint,senttech/OctoPrint,shohei/Octoprint,foosel/OctoPrint,shohei/Octoprint,bicephale/OctoPrint,senttech/OctoPrint,Salandora/OctoPrint,JackGavin13/octoprint-test-not-finished,senttech/OctoPrint,beeverycreative/BEEweb,bicephale/OctoPrint,foosel/OctoPrint,shohei/Octoprint,beeverycreative/BEEweb,MoonshineSG/OctoPrint,JackGavin13/octoprint-test-not-finished,chriskoz/OctoPrint,MoonshineSG/OctoPrint