fix socket reuse and add graceful shutdown for POP3

and get it working on OSX.