close device during a premature exit