Fixed PDF cleanup routine