Creates data directory before attempting to save the database.

Fixes #218.