Add close method and clean up on destroy calls