Refactor handle_funding_locked to wrapper error handling function