Single-pot conversion of an acid to the corresponding 4-chlorobutyl ester