support return-path properly and ensure quit finishes before calling callback