Fixed package creation error

Interupting the package creation step would lead to an incomplete and
corrupt package file. To avoid this the package is now written to a
temporary package file and then in the last step this file is moved to
the final package file.

Closes #14