Now generates pdf in correct folder and cleans up afterwards.