Locks: remove duplicate code, added pico_mutex_deinit() dependency