correct some possible resource leakage
add support for unlinking files from the FS