Sandy grounds thousands of flights