Handle close errors in compress