You have to consider your FIFO cost, not your weighted cost.
Buy 100 shares at $10
Buy 100 shares at $5
Weighted cost = 200 shares at 7.50
However if you sell 100 shares, you now have 100 shares at a cost of $5.
If you sold 101 shares, you now have 99 shares at a cost of $5.
These are the numbers that the year end spreadsheet from your broker will be using for tax.
In your scenario you bought 50 shares @ $25 = $1250
Then bought 1000 shares @ $5 = 5000
Total: $6250
You sold 50 shares @ $6 = $300
You sold 1000 shares @ $6 = $6000
Total: $6300
Profit: $50
You will pay tax on $50