Using with statement when handling files