adding in function to work with file handler, abstract out commonalities

Couple of changes...

* make sure pdo connection is successful in construct
* make sure base dir is created before making the date dir
* added new method to write to file handle for memory saving
 * still running into memory issues with some tables... but they're massive tables (~1GB). Not sure if the handle is efficient enough.
* abstracted out some common pieces between generateBackupScript and writeBackupScriptToFile
 * could be more abstract

Yeah, I didn't put in comments (yet). #yolo