A bit more error checking
More error checking, creating file instead of opening