Close testfile when cleanning up and sort rules at runtime.

The rules list is sorted at rutime for the test script, no need to have
2 lists.

The test file used in test_save_rules_file() is closed when cleaning up
after the test.