added error checking to passwordManager and write to dir