Closed-form Green's functions for general sources and stratified media