Fix regression errors

Tempfile.new creates and opens a file, but doesn't close it. Tests occasionally break because the file hasn't been flushed to disk yet. So we explicitly close it in tests.

[#45201623]
Use more readable switches in system commands
RSpec symbols default to true
Refactor/DRY test suites

Fix #includes_port? definition.
Clean up more after each test.