Add a close method on apn.