Destroy swapchain before removing the window info

This fixes an issue reported by valgrind where cleaning up the
swapchain fails because the window info is destroyed before.