call close to prevent hanging on shutdown