Using the quit-channel approach to close resources.