closing file descriptors before unlinking which is necessary on win32 platforms. Should fix #20