BasicPlatformTransaction throws an IllegalStateException if commit is called twice. This method will throw a NullPointerException. Could `checkState(transaction)` here to maintain the same behaviour.