Fixed NPE bug in flush() 

When tests are marked with @Ignore, an NPE will sometimes be thrown at the end of the test run, causing it to look like it's failed when it hasn't. This fix should prevent this from happening.