reader thread exits correctly