apns: fix connection management