Added additional protection for IO exceptions when flushing pages.