Fastify close() is asynchronous If you handling as synchronous, then you accidentally losing data, or resource. Checkout the code, and read the comments. Run with npm start and close with CTRL + C.