fix socket reuse and add graceful shutdown for POP3