Handle delete and escape keys