First batch of improvements

1. Added user input for the name of the database.
2. Added error handling for a closed database connection.
3. Added table locking for insertion speed.