Late expansion was causing issues with variables not actually making it into the trap call, resulting in poor cleaning up temp files.
This will allow us to add/remove shellcheck excludes more easily.