Fix PE linker wibbles
Fix some various issues that popped up because the linker now doesn't
load import libraries for longer than it needs to.
These are all use after free issues.
Test Plan: ./validate
Reviewers: bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: simonpj, rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5175