Refactoring of CleanUpTask

Twice now IntelliJ barfed on the magicky implicit that turned a Autoclosable into a CleanUpTask. This is my solution