Adds intelligent friendslist saving

Anywhere friend data is modified, exports.save() is invoked to ensure that the friendslist file does not lose anything in case of a crash.