I found where the LEAVE was mentioned and removed it. The .close you're calling is actually from IO::Pipe, not IO::Handle.
Probably something else should be clarified in the docs to avoid that sort of confusion as well. Marked it as TODO for my IO grant thing and will resolve this ticket as part of it.