Chart to Image Example - Fix

File stream is closed