Early on in WASI, we weren't sure whether we should allow preopens to be closed, so conservatively, we disallowed them. Among other things, this protected assumptions in wasi-libc that it can hold onto preopen file descriptors and rely on them always being open. However now, I think it makes sense to relax this restriction. wasi-libc itself doesn't expose the preopen file descriptors, so users shouldn't ever be closing them naively, unless they have wild closes. And toolchains other than wasi-libc may want to close preopens as a way to drop priveleges once the main file handles are opened.
This is the wasi-tests crate, which contains source code for the system-level WASI tests.
Building these tests requires that the wasm32-wasi target be installed.