Automatically cleans up old shares and the database