Adds a button to close the 'Add new identity' form, and improves the code for adding PT identities.