Role of absorption in grating erasure