Graceful shutdown middleware for express