bugfix fopen call

wasn't telling fopen the purpose of opening the file
also added back in code to remove metadata from db when
cancelling an alarm.