finalized screenshot function