Make hosted repository handle upload using PackageRequest for validation. Fix leaking file handler (thanks to http://file-leak-detector.kohsuke.org/), remember to always close streams