Create the shutdown context earlier so process begins handling shutdown signals earlier. Specifically, the context should be created before creating any resources which need a graceful shutdown such as the database. This is important because without explicit signal handling the process will terminate immediately upon receiving a signal without running deferred tasks.