Use handler to restart PostgreSQL

This reduces the amount of restart per run from 2 to 1