fix delayed run-db thread shutdown 

Closes #616

Makes the following changes:
 * Groups together related database operations (e.g. state updates) into single operations under the new `BulkDBOperObject` class.
 * Reduces the frequency of commit to database operations from after every operation (ultimately the cause of the queue backing up) to after every 10 operations OR whenever the database operations queue is emptied. In addition, a commit is also made on exiting the cursor loop to ensure final additions/updates to the database following the being told to shutdown the connection are made.
 * Also comments out two debug prints in `lib/cylc/task_types/clocktriggered.py` which are filling the logs (I missed this in my code review and testing of #619).

Shutdown of the Phil suite tested on my machine and pretty much instant now. Debug code for queue size shows the queue to be clearing now whereas previously it wasn't.